Skip to content

Commit

Permalink
packages/modeldb: only test indexes on sqlite and pg
Browse files Browse the repository at this point in the history
  • Loading branch information
joeltg committed Jan 15, 2025
1 parent 6c81a46 commit b18f37b
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions packages/modeldb/test/indexes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,25 @@ testOnModelDB("query (indexed order by)", async (t, openDB) => {
])
})

testOnModelDB("multi-property index", async (t, openDB) => {
const db = await openDB(t, {
user: {
address: "primary",
name: "string",
$indexes: ["address/name"],
},
})

await db.set("user", { address: "a", name: "John Doe" })
await db.set("user", { address: "c", name: "Jane Doe" })

// Ascending
t.deepEqual(await db.query("user", { orderBy: { address: "asc" } }), [
{ address: "a", name: "John Doe" },
{ address: "c", name: "Jane Doe" },
])
})
testOnModelDB(
"multi-property index",
async (t, openDB) => {
const db = await openDB(t, {
user: {
address: "primary",
name: "string",
$indexes: ["address/name"],
},
})

await db.set("user", { address: "a", name: "John Doe" })
await db.set("user", { address: "c", name: "Jane Doe" })

// Ascending
t.deepEqual(await db.query("user", { orderBy: { address: "asc" } }), [
{ address: "a", name: "John Doe" },
{ address: "c", name: "Jane Doe" },
])
},
{ sqlite: true, pg: true, do: true },
)

0 comments on commit b18f37b

Please sign in to comment.