Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ describe.skipIf(!sharedMongod)('[#5239] a real mongod returns the identity row s
});

const ids = async (where: unknown): Promise<string[]> => {
const rows = await driver.find('deal', { object: 'deal', where } as never);
const rows = await driver.find('deal', { where } as never);
return (rows as Record<string, unknown>[]).map((r) => String(r.id)).sort();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe.skipIf(!sharedMongod)('driver-mongodb — filter logic conformance', ()

for (const c of FILTER_LOGIC_CASES) {
it(c.name, async () => {
const rows = await driver.find('conformance', { object: 'conformance', where: c.filter } as any);
const rows = await driver.find('conformance', { where: c.filter });
const got = (rows as any[])
.map((r) => String(r.id))
.sort((x, y) => x.localeCompare(y));
Expand All @@ -82,7 +82,7 @@ describe.skipIf(!sharedMongod)('driver-mongodb — filter logic conformance', ()
* failed cannot read as a case that correctly excluded everything.
*/
it('the fixture really is all four rows', async () => {
const rows = await driver.find('conformance', { object: 'conformance' } as any);
const rows = await driver.find('conformance', {});
expect((rows as any[]).map((r) => String(r.id)).sort()).toEqual(['1', '2', '3', '4']);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('MongoDBDriver.findOne hands Mongo the whole query (#4419)', () => {

for (const c of FINDONE_CASES) {
it(`emits the right options — ${c.name}`, async () => {
await driver.findOne('account', { object: 'account', ...c.query } as any);
await driver.findOne('account', { ...c.query } as any);
const { options } = lastFindOne();

// `undefined` here is a real assertion, not an absent one: it is the
Expand All @@ -133,15 +133,15 @@ describe('MongoDBDriver.findOne hands Mongo the whole query (#4419)', () => {
}

it('translates the predicate, as it always did', async () => {
await driver.findOne('account', { object: 'account', where: { id: 'a' }, limit: 1 } as any);
await driver.findOne('account', { where: { id: 'a' }, limit: 1 });
expect(lastFindOne().filter).toMatchObject({ id: 'a' });
});

it('the transaction session still rides through', async () => {
const session = { id: 'sess-1' } as any;
await driver.findOne(
'account',
{ object: 'account', where: { id: 'a' }, limit: 1 } as any,
{ where: { id: 'a' }, limit: 1 },
{ transaction: session } as any,
);
expect(lastFindOne().options.session).toBe(session);
Expand All @@ -151,7 +151,7 @@ describe('MongoDBDriver.findOne hands Mongo the whole query (#4419)', () => {

for (const c of FINDONE_CASES) {
it(`selects the right row — ${c.name}`, async () => {
const row = await driver.findOne('account', { object: 'account', ...c.query } as any);
const row = await driver.findOne('account', { ...c.query } as any);
expect(row === null ? null : String((row as any).id)).toBe(c.expectId);
if (c.expectKeys && row) expect(new Set(Object.keys(row))).toEqual(new Set(c.expectKeys));
});
Expand All @@ -160,12 +160,12 @@ describe('MongoDBDriver.findOne hands Mongo the whole query (#4419)', () => {
// ── find() is unchanged: the carve-out is findOne-only ──────────────

it('an unordered PAGED find still gets a deterministic order imposed', async () => {
await driver.find('account', { object: 'account', limit: 2, offset: 0 } as any);
await driver.find('account', { limit: 2, offset: 0 });
expect(seen.find.at(-1)!.options.sort).toEqual({ id: 1 });
});

it('an unordered, unpaged find still gets none — that rule is unchanged', async () => {
await driver.find('account', { object: 'account' } as any);
await driver.find('account', {});
expect(seen.find.at(-1)!.options.sort).toBeUndefined();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe.skipIf(!sharedMongod)('driver-mongodb — findOne executes the whole qu

for (const c of FINDONE_CASES) {
it(c.name, async () => {
const row = await driver.findOne('account', { object: 'account', ...c.query } as any);
const row = await driver.findOne('account', { ...c.query } as any);
expect(row === null ? null : String((row as any).id)).toBe(c.expectId);
if (c.expectKeys && row) expect(new Set(Object.keys(row))).toEqual(new Set(c.expectKeys));
});
Expand All @@ -67,7 +67,7 @@ describe.skipIf(!sharedMongod)('driver-mongodb — findOne executes the whole qu
it('find() is unchanged — a paged walk is still a partition of the rows', async () => {
const seen: string[] = [];
for (let offset = 0; offset < FINDONE_ROWS.length; offset += 2) {
const page = await driver.find('account', { object: 'account', limit: 2, offset } as any);
const page = await driver.find('account', { limit: 2, offset });
seen.push(...page.map((r) => String(r.id)));
}
expect(seen).toHaveLength(FINDONE_ROWS.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const timeShape = (name: string) => ({

/** Row ids a filter reaches, sorted — the one thing every cell must agree on. */
async function matchedIds(driver: SqlDriver, table: string, where: unknown): Promise<string[]> {
const rows = await driver.find(table, { object: table, where } as any);
const rows = await driver.find(table, { where } as any);
return (rows as any[]).map((r) => r.id).sort();
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/query-options-erasure-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
"packages/services/service-settings/src/settings-service.ts": 2
},
"testSurface": {
"sites": 249
"sites": 242
}
}
Loading