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
41 changes: 6 additions & 35 deletions packages/objectql/src/engine-autonumber-default-format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,41 +46,12 @@ import { ObjectQL } from './engine';
import { SchemaRegistry } from './registry';
import type { IDataDriver } from '@objectstack/spec/contracts';

vi.mock('./registry', () => {
const instance: any = {
getObject: vi.fn(),
resolveObject: vi.fn((n: string) => instance.getObject(n)),
// [#9154] This double used to OMIT `getAllObjects`, and every test here
// passed anyway: the engine's roll-up summary index read it as
// `getAllObjects?.() ?? []`, so a double that does not model the method
// was indistinguishable from a registry with nothing in it — the write
// path silently skipped the insert-time roll-up seed (#5749) and the
// post-write recompute. With the optional call gone the omission is a
// hard `TypeError`, which is the point: the double now has to model the
// method the engine actually calls. Empty is the truthful body for THIS
// suite — it declares no `summary` field, so the roll-up index over it is
// empty either way, and now it says so instead of the engine inventing it.
getAllObjects: vi.fn(() => []),
registerObject: vi.fn(),
getObjectOwner: vi.fn(),
registerNamespace: vi.fn(),
registerKind: vi.fn(),
registerItem: vi.fn(),
registerApp: vi.fn(),
installPackage: vi.fn(),
reset: vi.fn(),
metadata: { get: vi.fn(() => new Map()) },
};
function SchemaRegistry() {
return instance;
}
Object.assign(SchemaRegistry, instance);
return {
SchemaRegistry,
computeFQN: (_ns: string | undefined, name: string) => name,
parseFQN: (fqn: string) => ({ namespace: undefined, shortName: fqn }),
RESERVED_NAMESPACES: new Set(['base', 'system']),
};
vi.mock('./registry', async () => {
// [#10551] The one shared factory — see `registry-module-mock.ts` for the
// member set, the #9002 / #9154 lessons it carries, and why the async factory
// form is what makes this import legal under `vi.mock` hoisting.
const { createRegistryModuleMock } = await import('./registry-module-mock.js');
return createRegistryModuleMock();
});

/** Date tokens render from the wall clock, so the clock is pinned. Only `Date`. */
Expand Down
41 changes: 6 additions & 35 deletions packages/objectql/src/engine-autonumber-defer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,12 @@ import type { IDataDriver } from '@objectstack/spec/contracts';
* A `required` autonumber must pass insert-validation in BOTH cases (the value
* is runtime-owned, assigned after validation in the native-driver case).
*/
vi.mock('./registry', () => {
const instance: any = {
getObject: vi.fn(),
resolveObject: vi.fn((n: string) => instance.getObject(n)),
// [#9154] This double used to OMIT `getAllObjects`, and every test here
// passed anyway: the engine's roll-up summary index read it as
// `getAllObjects?.() ?? []`, so a double that does not model the method
// was indistinguishable from a registry with nothing in it — the write
// path silently skipped the insert-time roll-up seed (#5749) and the
// post-write recompute. With the optional call gone the omission is a
// hard `TypeError`, which is the point: the double now has to model the
// method the engine actually calls. Empty is the truthful body for THIS
// suite — it declares no `summary` field, so the roll-up index over it is
// empty either way, and now it says so instead of the engine inventing it.
getAllObjects: vi.fn(() => []),
registerObject: vi.fn(),
getObjectOwner: vi.fn(),
registerNamespace: vi.fn(),
registerKind: vi.fn(),
registerItem: vi.fn(),
registerApp: vi.fn(),
installPackage: vi.fn(),
reset: vi.fn(),
metadata: { get: vi.fn(() => new Map()) },
};
function SchemaRegistry() {
return instance;
}
Object.assign(SchemaRegistry, instance);
return {
SchemaRegistry,
computeFQN: (_ns: string | undefined, name: string) => name,
parseFQN: (fqn: string) => ({ namespace: undefined, shortName: fqn }),
RESERVED_NAMESPACES: new Set(['base', 'system']),
};
vi.mock('./registry', async () => {
// [#10551] The one shared factory — see `registry-module-mock.ts` for the
// member set, the #9002 / #9154 lessons it carries, and why the async factory
// form is what makes this import legal under `vi.mock` hoisting.
const { createRegistryModuleMock } = await import('./registry-module-mock.js');
return createRegistryModuleMock();
});

function makeDriver(supportsAutonumber: boolean): IDataDriver & { created: any[] } {
Expand Down
41 changes: 6 additions & 35 deletions packages/objectql/src/engine-autonumber-resync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,41 +91,12 @@ import { ObjectQL } from './engine';
import { SchemaRegistry } from './registry';
import type { IDataDriver } from '@objectstack/spec/contracts';

vi.mock('./registry', () => {
const instance: any = {
getObject: vi.fn(),
resolveObject: vi.fn((n: string) => instance.getObject(n)),
// [#9154] This double used to OMIT `getAllObjects`, and every test here
// passed anyway: the engine's roll-up summary index read it as
// `getAllObjects?.() ?? []`, so a double that does not model the method
// was indistinguishable from a registry with nothing in it — the write
// path silently skipped the insert-time roll-up seed (#5749) and the
// post-write recompute. With the optional call gone the omission is a
// hard `TypeError`, which is the point: the double now has to model the
// method the engine actually calls. Empty is the truthful body for THIS
// suite — it declares no `summary` field, so the roll-up index over it is
// empty either way, and now it says so instead of the engine inventing it.
getAllObjects: vi.fn(() => []),
registerObject: vi.fn(),
getObjectOwner: vi.fn(),
registerNamespace: vi.fn(),
registerKind: vi.fn(),
registerItem: vi.fn(),
registerApp: vi.fn(),
installPackage: vi.fn(),
reset: vi.fn(),
metadata: { get: vi.fn(() => new Map()) },
};
function SchemaRegistry() {
return instance;
}
Object.assign(SchemaRegistry, instance);
return {
SchemaRegistry,
computeFQN: (_ns: string | undefined, name: string) => name,
parseFQN: (fqn: string) => ({ namespace: undefined, shortName: fqn }),
RESERVED_NAMESPACES: new Set(['base', 'system']),
};
vi.mock('./registry', async () => {
// [#10551] The one shared factory — see `registry-module-mock.ts` for the
// member set, the #9002 / #9154 lessons it carries, and why the async factory
// form is what makes this import legal under `vi.mock` hoisting.
const { createRegistryModuleMock } = await import('./registry-module-mock.js');
return createRegistryModuleMock();
});

/** Date tokens render from the wall clock, so the clock is pinned. */
Expand Down
41 changes: 6 additions & 35 deletions packages/objectql/src/engine-autonumber-seed-outage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,41 +37,12 @@ import { ObjectQL } from './engine';
import { SchemaRegistry } from './registry';
import type { IDataDriver } from '@objectstack/spec/contracts';

vi.mock('./registry', () => {
const instance: any = {
getObject: vi.fn(),
resolveObject: vi.fn((n: string) => instance.getObject(n)),
// [#9154] This double used to OMIT `getAllObjects`, and every test here
// passed anyway: the engine's roll-up summary index read it as
// `getAllObjects?.() ?? []`, so a double that does not model the method
// was indistinguishable from a registry with nothing in it — the write
// path silently skipped the insert-time roll-up seed (#5749) and the
// post-write recompute. With the optional call gone the omission is a
// hard `TypeError`, which is the point: the double now has to model the
// method the engine actually calls. Empty is the truthful body for THIS
// suite — it declares no `summary` field, so the roll-up index over it is
// empty either way, and now it says so instead of the engine inventing it.
getAllObjects: vi.fn(() => []),
registerObject: vi.fn(),
getObjectOwner: vi.fn(),
registerNamespace: vi.fn(),
registerKind: vi.fn(),
registerItem: vi.fn(),
registerApp: vi.fn(),
installPackage: vi.fn(),
reset: vi.fn(),
metadata: { get: vi.fn(() => new Map()) },
};
function SchemaRegistry() {
return instance;
}
Object.assign(SchemaRegistry, instance);
return {
SchemaRegistry,
computeFQN: (_ns: string | undefined, name: string) => name,
parseFQN: (fqn: string) => ({ namespace: undefined, shortName: fqn }),
RESERVED_NAMESPACES: new Set(['base', 'system']),
};
vi.mock('./registry', async () => {
// [#10551] The one shared factory — see `registry-module-mock.ts` for the
// member set, the #9002 / #9154 lessons it carries, and why the async factory
// form is what makes this import legal under `vi.mock` hoisting.
const { createRegistryModuleMock } = await import('./registry-module-mock.js');
return createRegistryModuleMock();
});

const DOC_SCHEMA = {
Expand Down
41 changes: 6 additions & 35 deletions packages/objectql/src/engine-autonumber-seed-scan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,41 +41,12 @@ import { ObjectQL } from './engine';
import { SchemaRegistry } from './registry';
import type { IDataDriver } from '@objectstack/spec/contracts';

vi.mock('./registry', () => {
const instance: any = {
getObject: vi.fn(),
resolveObject: vi.fn((n: string) => instance.getObject(n)),
// [#9154] This double used to OMIT `getAllObjects`, and every test here
// passed anyway: the engine's roll-up summary index read it as
// `getAllObjects?.() ?? []`, so a double that does not model the method
// was indistinguishable from a registry with nothing in it — the write
// path silently skipped the insert-time roll-up seed (#5749) and the
// post-write recompute. With the optional call gone the omission is a
// hard `TypeError`, which is the point: the double now has to model the
// method the engine actually calls. Empty is the truthful body for THIS
// suite — it declares no `summary` field, so the roll-up index over it is
// empty either way, and now it says so instead of the engine inventing it.
getAllObjects: vi.fn(() => []),
registerObject: vi.fn(),
getObjectOwner: vi.fn(),
registerNamespace: vi.fn(),
registerKind: vi.fn(),
registerItem: vi.fn(),
registerApp: vi.fn(),
installPackage: vi.fn(),
reset: vi.fn(),
metadata: { get: vi.fn(() => new Map()) },
};
function SchemaRegistry() {
return instance;
}
Object.assign(SchemaRegistry, instance);
return {
SchemaRegistry,
computeFQN: (_ns: string | undefined, name: string) => name,
parseFQN: (fqn: string) => ({ namespace: undefined, shortName: fqn }),
RESERVED_NAMESPACES: new Set(['base', 'system']),
};
vi.mock('./registry', async () => {
// [#10551] The one shared factory — see `registry-module-mock.ts` for the
// member set, the #9002 / #9154 lessons it carries, and why the async factory
// form is what makes this import legal under `vi.mock` hoisting.
const { createRegistryModuleMock } = await import('./registry-module-mock.js');
return createRegistryModuleMock();
});

/** The page size the seeding walk uses — a PAGE, not a cap, since #6249. */
Expand Down
41 changes: 6 additions & 35 deletions packages/objectql/src/engine-autonumber-seed-suffix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,12 @@ import { ObjectQL } from './engine';
import { SchemaRegistry } from './registry';
import type { IDataDriver } from '@objectstack/spec/contracts';

vi.mock('./registry', () => {
const instance: any = {
getObject: vi.fn(),
resolveObject: vi.fn((n: string) => instance.getObject(n)),
// [#9154] This double used to OMIT `getAllObjects`, and every test here
// passed anyway: the engine's roll-up summary index read it as
// `getAllObjects?.() ?? []`, so a double that does not model the method
// was indistinguishable from a registry with nothing in it — the write
// path silently skipped the insert-time roll-up seed (#5749) and the
// post-write recompute. With the optional call gone the omission is a
// hard `TypeError`, which is the point: the double now has to model the
// method the engine actually calls. Empty is the truthful body for THIS
// suite — it declares no `summary` field, so the roll-up index over it is
// empty either way, and now it says so instead of the engine inventing it.
getAllObjects: vi.fn(() => []),
registerObject: vi.fn(),
getObjectOwner: vi.fn(),
registerNamespace: vi.fn(),
registerKind: vi.fn(),
registerItem: vi.fn(),
registerApp: vi.fn(),
installPackage: vi.fn(),
reset: vi.fn(),
metadata: { get: vi.fn(() => new Map()) },
};
function SchemaRegistry() {
return instance;
}
Object.assign(SchemaRegistry, instance);
return {
SchemaRegistry,
computeFQN: (_ns: string | undefined, name: string) => name,
parseFQN: (fqn: string) => ({ namespace: undefined, shortName: fqn }),
RESERVED_NAMESPACES: new Set(['base', 'system']),
};
vi.mock('./registry', async () => {
// [#10551] The one shared factory — see `registry-module-mock.ts` for the
// member set, the #9002 / #9154 lessons it carries, and why the async factory
// form is what makes this import legal under `vi.mock` hoisting.
const { createRegistryModuleMock } = await import('./registry-module-mock.js');
return createRegistryModuleMock();
});

/**
Expand Down
30 changes: 6 additions & 24 deletions packages/objectql/src/engine-count-read-filter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,12 @@ import { SchemaRegistry } from './registry';
* These tests assert on what the DRIVER receives: the middleware's filter
* must be present in the ast that reaches driver.count / driver.aggregate.
*/
vi.mock('./registry', () => {
const instance: any = {
getObject: vi.fn(),
resolveObject: vi.fn((n: string) => instance.getObject(n)),
registerObject: vi.fn(),
getObjectOwner: vi.fn(),
registerNamespace: vi.fn(),
registerKind: vi.fn(),
registerItem: vi.fn(),
registerApp: vi.fn(),
installPackage: vi.fn(),
reset: vi.fn(),
metadata: { get: vi.fn(() => new Map()) },
};
function SchemaRegistry() {
return instance;
}
Object.assign(SchemaRegistry, instance);
return {
SchemaRegistry,
computeFQN: (_ns: string | undefined, name: string) => name,
parseFQN: (fqn: string) => ({ namespace: undefined, shortName: fqn }),
RESERVED_NAMESPACES: new Set(['base', 'system']),
};
vi.mock('./registry', async () => {
// [#10551] The one shared factory — see `registry-module-mock.ts` for the
// member set, the #9002 / #9154 lessons it carries, and why the async factory
// form is what makes this import legal under `vi.mock` hoisting.
const { createRegistryModuleMock } = await import('./registry-module-mock.js');
return createRegistryModuleMock();
});

const NOTE_SCHEMA = {
Expand Down
41 changes: 6 additions & 35 deletions packages/objectql/src/engine-filter-tokens.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,12 @@ import { SchemaRegistry } from './registry';
* These tests assert on what the DRIVER receives: no `{token}` may survive to
* the driver AST, and an unresolvable one must throw rather than pass through.
*/
vi.mock('./registry', () => {
const instance: any = {
getObject: vi.fn(),
resolveObject: vi.fn((n: string) => instance.getObject(n)),
// [#9154] This double used to OMIT `getAllObjects`, and every test here
// passed anyway: the engine's roll-up summary index read it as
// `getAllObjects?.() ?? []`, so a double that does not model the method
// was indistinguishable from a registry with nothing in it — the write
// path silently skipped the insert-time roll-up seed (#5749) and the
// post-write recompute. With the optional call gone the omission is a
// hard `TypeError`, which is the point: the double now has to model the
// method the engine actually calls. Empty is the truthful body for THIS
// suite — it declares no `summary` field, so the roll-up index over it is
// empty either way, and now it says so instead of the engine inventing it.
getAllObjects: vi.fn(() => []),
registerObject: vi.fn(),
getObjectOwner: vi.fn(),
registerNamespace: vi.fn(),
registerKind: vi.fn(),
registerItem: vi.fn(),
registerApp: vi.fn(),
installPackage: vi.fn(),
reset: vi.fn(),
metadata: { get: vi.fn(() => new Map()) },
};
function SchemaRegistry() {
return instance;
}
Object.assign(SchemaRegistry, instance);
return {
SchemaRegistry,
computeFQN: (_ns: string | undefined, name: string) => name,
parseFQN: (fqn: string) => ({ namespace: undefined, shortName: fqn }),
RESERVED_NAMESPACES: new Set(['base', 'system']),
};
vi.mock('./registry', async () => {
// [#10551] The one shared factory — see `registry-module-mock.ts` for the
// member set, the #9002 / #9154 lessons it carries, and why the async factory
// form is what makes this import legal under `vi.mock` hoisting.
const { createRegistryModuleMock } = await import('./registry-module-mock.js');
return createRegistryModuleMock();
});

const DEAL_SCHEMA = {
Expand Down
Loading
Loading