-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
95 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { chorm } from "../index.test"; | ||
|
||
export default async function () { | ||
const testDesc = await chorm.query.ordering.findMany({ | ||
where: (columns, { isNotNull }) => isNotNull(columns.num), | ||
limit: 5, | ||
}); | ||
|
||
expect(testDesc).toBeDefined(); | ||
expect(testDesc).toHaveLength(5); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { chorm } from "../index.test"; | ||
|
||
export default async function () { | ||
const testDesc = await chorm.query.ordering.findMany({ | ||
where: (columns, { isNotNull }) => isNotNull(columns.num), | ||
offset: 2, | ||
orderBy(columns, conditions) { | ||
return conditions.asc(columns.num); | ||
}, | ||
}); | ||
|
||
expect(testDesc).toBeDefined(); | ||
expect(testDesc?.[0]?.num).toBe(2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { chorm } from "../index.test"; | ||
|
||
export default async function () { | ||
const userIds = new Array(100).fill(0).map((_, i) => i); | ||
|
||
for await (const id of userIds) { | ||
const query = await chorm.query.ordering.insert({ | ||
id: id.toString(), | ||
num: id, | ||
}); | ||
|
||
expect(query).toBeDefined(); | ||
} | ||
|
||
const testDesc = await chorm.query.ordering.findMany({ | ||
where: (columns, { isNotNull }) => isNotNull(columns.num), | ||
orderBy: (columns, { desc }) => desc(columns.num), | ||
}); | ||
|
||
expect(testDesc).toBeDefined(); | ||
expect(testDesc).toHaveLength(100); | ||
expect(testDesc?.[0]?.num).toBe(99); | ||
|
||
const testAsc = await chorm.query.ordering.findMany({ | ||
where: (columns, { isNotNull }) => isNotNull(columns.num), | ||
orderBy: (columns, { asc }) => asc(columns.num), | ||
}); | ||
|
||
expect(testAsc).toBeDefined(); | ||
expect(testAsc).toHaveLength(100); | ||
expect(testAsc?.[0]?.num).toBe(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters