Skip to content

Commit

Permalink
Add a select test for named tuples separate from FTS
Browse files Browse the repository at this point in the history
  • Loading branch information
scotttrinh committed Nov 8, 2023
1 parent df213db commit 127d190
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions integration-tests/lts/select.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,28 @@ describe("select", () => {
);
});

test("named tuples", async () => {
const namedTuple = e.tuple({ foo: e.str("bar") });
const result = await e.select(namedTuple).run(client);
assert.deepEqual(result, { foo: "bar" });

const pathResult = await e.select(namedTuple.foo).run(client);
assert.deepEqual(pathResult, "bar");

const nestedObjectTuple = e.for(e.select(e.Hero), (hero) =>
e.tuple({
hero,
score: e.random(),
})
);
const nestedObjectQuery = e.select(nestedObjectTuple.hero, (hero) => ({
name: hero.name,
order_by: nestedObjectTuple.score,
}));
const nestedObjectResult = await nestedObjectQuery.run(client);
assert.deepEqual(nestedObjectResult, []);
});

test("filter by id", async () => {
const result = await e
.select(e.Hero, () => ({
Expand Down

0 comments on commit 127d190

Please sign in to comment.