@danceroutine/tango-testing 1.11.0 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{aDBClient-CH-ZcOaP.js → aDBClient-fMkIdR7p.js} +16 -7
- package/dist/aDBClient-fMkIdR7p.js.map +1 -0
- package/dist/assertions/index.d.ts +2 -4
- package/dist/assertions/index.js +2 -3
- package/dist/assertions-lsAd7fhA.js +15 -0
- package/dist/assertions-lsAd7fhA.js.map +1 -0
- package/dist/chunk-D7D4PA-g.js +13 -0
- package/dist/express/index.d.ts +2 -3
- package/dist/express/index.js +2 -3
- package/dist/{express-Czpfz_Ay.js → express-CH6_GAyC.js} +23 -15
- package/dist/express-CH6_GAyC.js.map +1 -0
- package/dist/factories/index.d.ts +2 -4
- package/dist/factories/index.js +2 -3
- package/dist/{factories-Cl_CAzbj.js → factories-qAJouv1I.js} +10 -8
- package/dist/factories-qAJouv1I.js.map +1 -0
- package/dist/index-49XmDOxW.d.ts +40 -0
- package/dist/index-B4H3wYuR.d.ts +325 -0
- package/dist/index-BCWo7zAn.d.ts +41 -0
- package/dist/index-CKVKW5j_.d.ts +15 -0
- package/dist/index-CnUPgs3G.d.ts +208 -0
- package/dist/index.d.ts +7 -19
- package/dist/index.js +8 -9
- package/dist/integration/index.d.ts +2 -18
- package/dist/integration/index.js +2 -4
- package/dist/{integration-CaRF_lF_.js → integration-CLzkacon.js} +99 -84
- package/dist/integration-CLzkacon.js.map +1 -0
- package/dist/mocks/index.d.ts +2 -20
- package/dist/mocks/index.js +3 -4
- package/dist/{mocks-BL_0iuAI.js → mocks-JyZwO-W4.js} +77 -65
- package/dist/mocks-JyZwO-W4.js.map +1 -0
- package/dist/vitest/index.d.ts +60 -3
- package/dist/vitest/index.js +119 -4
- package/dist/vitest/index.js.map +1 -0
- package/package.json +8 -8
- package/dist/aDBClient-CH-ZcOaP.js.map +0 -1
- package/dist/assertions/assertions.d.ts +0 -7
- package/dist/assertions-CCFZ53Y-.js +0 -15
- package/dist/assertions-CCFZ53Y-.js.map +0 -1
- package/dist/chunk-BkvOhyD0.js +0 -12
- package/dist/express/anExpressRequest.d.ts +0 -24
- package/dist/express/anExpressResponse.d.ts +0 -9
- package/dist/express-Czpfz_Ay.js.map +0 -1
- package/dist/factories/ModelDataFactory.d.ts +0 -33
- package/dist/factories-Cl_CAzbj.js.map +0 -1
- package/dist/integration/HarnessStrategyRegistry.d.ts +0 -25
- package/dist/integration/TestHarness.d.ts +0 -38
- package/dist/integration/anIntegrationHarness.d.ts +0 -5
- package/dist/integration/config.d.ts +0 -11
- package/dist/integration/conformance/index.d.ts +0 -1
- package/dist/integration/conformance/runDialectConformanceSuite.d.ts +0 -11
- package/dist/integration/domain/Dialect.d.ts +0 -5
- package/dist/integration/domain/HarnessStrategy.d.ts +0 -17
- package/dist/integration/domain/IntegrationHarness.d.ts +0 -22
- package/dist/integration/domain/ResetMode.d.ts +0 -6
- package/dist/integration/domain/index.d.ts +0 -7
- package/dist/integration/migrations/ApplyAndVerifyMigrations.d.ts +0 -16
- package/dist/integration/migrations/AssertMigrationPlan.d.ts +0 -9
- package/dist/integration/migrations/IntrospectSchema.d.ts +0 -5
- package/dist/integration/migrations/index.d.ts +0 -6
- package/dist/integration/orm/createModelQuerySetFixture.d.ts +0 -10
- package/dist/integration/orm/createQuerySetFixture.d.ts +0 -10
- package/dist/integration/orm/expectQueryResult.d.ts +0 -4
- package/dist/integration/orm/index.d.ts +0 -7
- package/dist/integration/orm/seedTable.d.ts +0 -5
- package/dist/integration/runtime/aTangoConfig.d.ts +0 -9
- package/dist/integration/runtime/aTangoRuntime.d.ts +0 -6
- package/dist/integration/runtime/index.d.ts +0 -7
- package/dist/integration/runtime/setupTestTangoRuntime.d.ts +0 -6
- package/dist/integration/smoke/AppProcessHarness.d.ts +0 -83
- package/dist/integration/smoke/index.d.ts +0 -4
- package/dist/integration/strategies/PostgresHarnessStrategy.d.ts +0 -19
- package/dist/integration/strategies/SqliteHarnessStrategy.d.ts +0 -19
- package/dist/integration-CaRF_lF_.js.map +0 -1
- package/dist/mocks/DBClient.d.ts +0 -1
- package/dist/mocks/MockQuerySetResult.d.ts +0 -6
- package/dist/mocks/aDBClient.d.ts +0 -24
- package/dist/mocks/aManager.d.ts +0 -20
- package/dist/mocks/aManyToManyRelatedManager.d.ts +0 -52
- package/dist/mocks/aModelQuerySet.d.ts +0 -8
- package/dist/mocks/aQueryExecutor.d.ts +0 -16
- package/dist/mocks/aQueryResult.d.ts +0 -9
- package/dist/mocks/aQuerySet.d.ts +0 -5
- package/dist/mocks/aRelationMeta.d.ts +0 -20
- package/dist/mocks/aRequestContext.d.ts +0 -22
- package/dist/mocks/anAdapter.d.ts +0 -13
- package/dist/mocks-BL_0iuAI.js.map +0 -1
- package/dist/vitest/registerVitestTango.d.ts +0 -46
- package/dist/vitest/withGlobalTestApi.d.ts +0 -7
- package/dist/vitest-BqZmULOa.js +0 -111
- package/dist/vitest-BqZmULOa.js.map +0 -1
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { PostgresAdapter, SqliteAdapter } from "@danceroutine/tango-orm";
|
|
2
2
|
import { vi } from "vitest";
|
|
3
|
-
|
|
4
3
|
//#region src/mocks/anAdapter.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create a real built-in `Adapter` instance for unit tests that need one.
|
|
6
|
+
*
|
|
7
|
+
* Defaults to a Postgres adapter; pass `{ dialect: 'sqlite' }` to obtain a
|
|
8
|
+
* SQLite adapter. The returned adapter carries the matching placeholder
|
|
9
|
+
* formatter so compilers exercised under test emit dialect-accurate SQL.
|
|
10
|
+
*/
|
|
5
11
|
function anAdapter(overrides = {}) {
|
|
6
12
|
const dialect = overrides.dialect ?? "postgres";
|
|
7
13
|
switch (dialect) {
|
|
@@ -10,9 +16,13 @@ function anAdapter(overrides = {}) {
|
|
|
10
16
|
default: throw new Error(`Unsupported dialect: ${dialect}`);
|
|
11
17
|
}
|
|
12
18
|
}
|
|
13
|
-
|
|
14
19
|
//#endregion
|
|
15
20
|
//#region src/mocks/aDBClient.ts
|
|
21
|
+
/**
|
|
22
|
+
* Create a lightweight `DBClient` test double with optional behavior overrides.
|
|
23
|
+
* The `query` override accepts any function returning `Promise<{ rows: any[] }>`,
|
|
24
|
+
* so concrete-typed Vitest mocks do not require a cast at the call site.
|
|
25
|
+
*/
|
|
16
26
|
function aDBClient(overrides = {}) {
|
|
17
27
|
const queryImpl = overrides.query ?? (async (_sql, _params) => ({ rows: [] }));
|
|
18
28
|
const beginImpl = overrides.begin ?? (async () => {});
|
|
@@ -22,7 +32,7 @@ function aDBClient(overrides = {}) {
|
|
|
22
32
|
const createSavepointImpl = overrides.createSavepoint ?? (async (_name) => {});
|
|
23
33
|
const releaseSavepointImpl = overrides.releaseSavepoint ?? (async (_name) => {});
|
|
24
34
|
const rollbackToSavepointImpl = overrides.rollbackToSavepoint ?? (async (_name) => {});
|
|
25
|
-
|
|
35
|
+
return {
|
|
26
36
|
query: vi.fn((sql, params) => queryImpl(sql, params)),
|
|
27
37
|
begin: vi.fn(() => beginImpl()),
|
|
28
38
|
commit: vi.fn(() => commitImpl()),
|
|
@@ -32,9 +42,8 @@ function aDBClient(overrides = {}) {
|
|
|
32
42
|
releaseSavepoint: vi.fn((name) => releaseSavepointImpl(name)),
|
|
33
43
|
rollbackToSavepoint: vi.fn((name) => rollbackToSavepointImpl(name))
|
|
34
44
|
};
|
|
35
|
-
return client;
|
|
36
45
|
}
|
|
37
|
-
|
|
38
46
|
//#endregion
|
|
39
|
-
export {
|
|
40
|
-
|
|
47
|
+
export { anAdapter as n, aDBClient as t };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=aDBClient-fMkIdR7p.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aDBClient-fMkIdR7p.js","names":[],"sources":["../src/mocks/anAdapter.ts","../src/mocks/aDBClient.ts"],"sourcesContent":["import { PostgresAdapter, SqliteAdapter, type Adapter } from '@danceroutine/tango-orm';\nimport type { Dialect } from '@danceroutine/tango-orm/query';\n\nexport type AdapterOverrides = {\n dialect?: Dialect;\n};\n\n/**\n * Create a real built-in `Adapter` instance for unit tests that need one.\n *\n * Defaults to a Postgres adapter; pass `{ dialect: 'sqlite' }` to obtain a\n * SQLite adapter. The returned adapter carries the matching placeholder\n * formatter so compilers exercised under test emit dialect-accurate SQL.\n */\nexport function anAdapter(overrides: AdapterOverrides = {}): Adapter {\n const dialect: Dialect = overrides.dialect ?? 'postgres';\n switch (dialect) {\n case 'postgres':\n return new PostgresAdapter();\n case 'sqlite':\n return new SqliteAdapter();\n default:\n throw new Error(`Unsupported dialect: ${dialect}`);\n }\n}\n","import { vi } from 'vitest';\nimport type { DBClient } from './DBClient';\n\n/**\n * Looser override type for `aDBClient` that accepts concrete-typed query mocks.\n * Consumers should not need to cast their mocks to satisfy `DBClient['query']`'s generic.\n */\ntype DBClientOverrides = {\n // oxlint-disable-next-line typescript/no-explicit-any\n query?: (sql: string, params?: readonly unknown[]) => Promise<{ rows: any[] }>;\n begin?: () => Promise<void>;\n commit?: () => Promise<void>;\n rollback?: () => Promise<void>;\n close?: () => Promise<void>;\n createSavepoint?: (name: string) => Promise<void>;\n releaseSavepoint?: (name: string) => Promise<void>;\n rollbackToSavepoint?: (name: string) => Promise<void>;\n};\n\n/**\n * Create a lightweight `DBClient` test double with optional behavior overrides.\n * The `query` override accepts any function returning `Promise<{ rows: any[] }>`,\n * so concrete-typed Vitest mocks do not require a cast at the call site.\n */\nexport function aDBClient(overrides: DBClientOverrides = {}): DBClient {\n const queryImpl =\n // oxlint-disable-next-line typescript/no-explicit-any\n overrides.query ?? (async (_sql: string, _params?: readonly unknown[]) => ({ rows: [] as any[] }));\n const beginImpl = overrides.begin ?? (async () => {});\n const commitImpl = overrides.commit ?? (async () => {});\n const rollbackImpl = overrides.rollback ?? (async () => {});\n const closeImpl = overrides.close ?? (async () => {});\n const createSavepointImpl = overrides.createSavepoint ?? (async (_name: string) => {});\n const releaseSavepointImpl = overrides.releaseSavepoint ?? (async (_name: string) => {});\n const rollbackToSavepointImpl = overrides.rollbackToSavepoint ?? (async (_name: string) => {});\n\n const client: DBClient = {\n query: vi.fn((sql: string, params?: readonly unknown[]) => queryImpl(sql, params)) as DBClient['query'],\n begin: vi.fn(() => beginImpl()),\n commit: vi.fn(() => commitImpl()),\n rollback: vi.fn(() => rollbackImpl()),\n close: vi.fn(() => closeImpl()),\n createSavepoint: vi.fn((name: string) => createSavepointImpl(name)),\n releaseSavepoint: vi.fn((name: string) => releaseSavepointImpl(name)),\n rollbackToSavepoint: vi.fn((name: string) => rollbackToSavepointImpl(name)),\n };\n\n return client;\n}\n"],"mappings":";;;;;;;;;;AAcA,SAAgB,UAAU,YAA8B,CAAC,GAAY;CACjE,MAAM,UAAmB,UAAU,WAAW;CAC9C,QAAQ,SAAR;EACI,KAAK,YACD,OAAO,IAAI,gBAAgB;EAC/B,KAAK,UACD,OAAO,IAAI,cAAc;EAC7B,SACI,MAAM,IAAI,MAAM,wBAAwB,SAAS;CACzD;AACJ;;;;;;;;ACAA,SAAgB,UAAU,YAA+B,CAAC,GAAa;CACnE,MAAM,YAEF,UAAU,UAAU,OAAO,MAAc,aAAkC,EAAE,MAAM,CAAC,EAAW;CACnG,MAAM,YAAY,UAAU,UAAU,YAAY,CAAC;CACnD,MAAM,aAAa,UAAU,WAAW,YAAY,CAAC;CACrD,MAAM,eAAe,UAAU,aAAa,YAAY,CAAC;CACzD,MAAM,YAAY,UAAU,UAAU,YAAY,CAAC;CACnD,MAAM,sBAAsB,UAAU,oBAAoB,OAAO,UAAkB,CAAC;CACpF,MAAM,uBAAuB,UAAU,qBAAqB,OAAO,UAAkB,CAAC;CACtF,MAAM,0BAA0B,UAAU,wBAAwB,OAAO,UAAkB,CAAC;CAa5F,OAAO;EAVH,OAAO,GAAG,IAAI,KAAa,WAAgC,UAAU,KAAK,MAAM,CAAC;EACjF,OAAO,GAAG,SAAS,UAAU,CAAC;EAC9B,QAAQ,GAAG,SAAS,WAAW,CAAC;EAChC,UAAU,GAAG,SAAS,aAAa,CAAC;EACpC,OAAO,GAAG,SAAS,UAAU,CAAC;EAC9B,iBAAiB,GAAG,IAAI,SAAiB,oBAAoB,IAAI,CAAC;EAClE,kBAAkB,GAAG,IAAI,SAAiB,qBAAqB,IAAI,CAAC;EACpE,qBAAqB,GAAG,IAAI,SAAiB,wBAAwB,IAAI,CAAC;CAGlE;AAChB"}
|
package/dist/assertions/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { assertions } from "../assertions-
|
|
2
|
-
|
|
3
|
-
export { assertions };
|
|
1
|
+
import { n as assertions } from "../assertions-lsAd7fhA.js";
|
|
2
|
+
export { assertions };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { t as __exportAll } from "./chunk-D7D4PA-g.js";
|
|
2
|
+
//#region src/assertions/assertions.ts
|
|
3
|
+
/**
|
|
4
|
+
* Assertion helpers for Tango models.
|
|
5
|
+
*/
|
|
6
|
+
const assertions = { matchesSchema(model, data) {
|
|
7
|
+
model.parse(data);
|
|
8
|
+
} };
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/assertions/index.ts
|
|
11
|
+
var assertions_exports = /* @__PURE__ */ __exportAll({ assertions: () => assertions });
|
|
12
|
+
//#endregion
|
|
13
|
+
export { assertions as n, assertions_exports as t };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=assertions-lsAd7fhA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions-lsAd7fhA.js","names":[],"sources":["../src/assertions/assertions.ts","../src/assertions/index.ts"],"sourcesContent":["import type { GenericModelFactory } from '../factories';\n\n/**\n * Assertion helpers for Tango models.\n */\nexport const assertions = {\n matchesSchema<TModel extends GenericModelFactory<Record<string, unknown>, unknown>>(\n model: TModel,\n data: unknown\n ): asserts data is ReturnType<TModel['parse']> {\n model.parse(data);\n },\n};\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { assertions } from './assertions';\n"],"mappings":";;;;;AAKA,MAAa,aAAa,EACtB,cACI,OACA,MAC2C;CAC3C,MAAM,MAAM,IAAI;AACpB,EACJ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll as t };
|
package/dist/express/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
export { anExpressResponse } from './anExpressResponse';
|
|
1
|
+
import { i as anExpressRequest, n as anExpressResponse, r as ExpressRequestOverrides } from "../index-BCWo7zAn.js";
|
|
2
|
+
export { type ExpressRequestOverrides, anExpressRequest, anExpressResponse };
|
package/dist/express/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export { anExpressRequest, anExpressResponse };
|
|
1
|
+
import { n as anExpressResponse, r as anExpressRequest } from "../express-CH6_GAyC.js";
|
|
2
|
+
export { anExpressRequest, anExpressResponse };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { vi
|
|
3
|
-
|
|
1
|
+
import { t as __exportAll } from "./chunk-D7D4PA-g.js";
|
|
2
|
+
import { vi } from "vitest";
|
|
4
3
|
//#region src/express/anExpressRequest.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create a minimal Express `Request` test double.
|
|
6
|
+
* The `get` method is a Vitest mock that returns `'localhost:3000'` for the
|
|
7
|
+
* `host` header and `undefined` for everything else, matching the most common
|
|
8
|
+
* test pattern. Override any field via the `overrides` argument.
|
|
9
|
+
*/
|
|
5
10
|
function anExpressRequest(overrides = {}) {
|
|
6
11
|
return {
|
|
7
12
|
protocol: "http",
|
|
@@ -9,18 +14,24 @@ function anExpressRequest(overrides = {}) {
|
|
|
9
14
|
originalUrl: "/",
|
|
10
15
|
url: "/",
|
|
11
16
|
headers: {},
|
|
12
|
-
body:
|
|
17
|
+
body: void 0,
|
|
13
18
|
params: {},
|
|
14
|
-
get: vi
|
|
19
|
+
get: vi.fn((name) => name.toLowerCase() === "host" ? "localhost:3000" : void 0),
|
|
15
20
|
...overrides
|
|
16
21
|
};
|
|
17
22
|
}
|
|
18
|
-
|
|
19
23
|
//#endregion
|
|
20
24
|
//#region src/express/anExpressResponse.ts
|
|
25
|
+
/**
|
|
26
|
+
* Create an Express `Response` test double.
|
|
27
|
+
*
|
|
28
|
+
* Every Express `Response` method is backed by a `vi.fn()`.
|
|
29
|
+
* Chainable methods (`status`, `sendStatus`, `links`, etc.) return `res`.
|
|
30
|
+
* Use `vi.mocked()` to access the mock API for assertions.
|
|
31
|
+
*/
|
|
21
32
|
function anExpressResponse() {
|
|
22
33
|
const res = {};
|
|
23
|
-
const
|
|
34
|
+
for (const method of [
|
|
24
35
|
"status",
|
|
25
36
|
"sendStatus",
|
|
26
37
|
"links",
|
|
@@ -35,8 +46,7 @@ function anExpressResponse() {
|
|
|
35
46
|
"location",
|
|
36
47
|
"vary",
|
|
37
48
|
"append"
|
|
38
|
-
];
|
|
39
|
-
for (const method of chainable) res[method] = vi.fn().mockReturnValue(res);
|
|
49
|
+
]) res[method] = vi.fn().mockReturnValue(res);
|
|
40
50
|
res.send = vi.fn().mockReturnValue(res);
|
|
41
51
|
res.json = vi.fn().mockReturnValue(res);
|
|
42
52
|
res.jsonp = vi.fn().mockReturnValue(res);
|
|
@@ -54,15 +64,13 @@ function anExpressResponse() {
|
|
|
54
64
|
res.req = {};
|
|
55
65
|
return res;
|
|
56
66
|
}
|
|
57
|
-
|
|
58
67
|
//#endregion
|
|
59
68
|
//#region src/express/index.ts
|
|
60
|
-
var express_exports = {
|
|
61
|
-
__export(express_exports, {
|
|
69
|
+
var express_exports = /* @__PURE__ */ __exportAll({
|
|
62
70
|
anExpressRequest: () => anExpressRequest,
|
|
63
71
|
anExpressResponse: () => anExpressResponse
|
|
64
72
|
});
|
|
65
|
-
|
|
66
73
|
//#endregion
|
|
67
|
-
export {
|
|
68
|
-
|
|
74
|
+
export { anExpressResponse as n, anExpressRequest as r, express_exports as t };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=express-CH6_GAyC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express-CH6_GAyC.js","names":[],"sources":["../src/express/anExpressRequest.ts","../src/express/anExpressResponse.ts","../src/express/index.ts"],"sourcesContent":["import { vi } from 'vitest';\nimport type { Request } from 'express';\n\ntype ExpressRequestParams = Request['params'] | Record<string, string | string[]>;\n\n/**\n * Overrides accepted by `anExpressRequest`. All fields are optional;\n * sensible defaults are provided for a minimal GET request.\n */\nexport type ExpressRequestOverrides = {\n protocol?: string;\n method?: string;\n originalUrl?: string;\n url?: string;\n // oxlint-disable-next-line typescript/no-explicit-any\n headers?: Record<string, any>;\n // oxlint-disable-next-line typescript/no-explicit-any\n body?: any;\n params?: ExpressRequestParams;\n get?: (name: string) => string | undefined;\n};\n\n/**\n * Create a minimal Express `Request` test double.\n * The `get` method is a Vitest mock that returns `'localhost:3000'` for the\n * `host` header and `undefined` for everything else, matching the most common\n * test pattern. Override any field via the `overrides` argument.\n */\nexport function anExpressRequest(overrides: ExpressRequestOverrides = {}): Request {\n return {\n protocol: 'http',\n method: 'GET',\n originalUrl: '/',\n url: '/',\n headers: {},\n body: undefined,\n params: {},\n get: vi.fn((name: string) => (name.toLowerCase() === 'host' ? 'localhost:3000' : undefined)),\n ...overrides,\n } as unknown as Request;\n}\n","import { vi } from 'vitest';\nimport type { Response } from 'express';\n\n/**\n * Create an Express `Response` test double.\n *\n * Every Express `Response` method is backed by a `vi.fn()`.\n * Chainable methods (`status`, `sendStatus`, `links`, etc.) return `res`.\n * Use `vi.mocked()` to access the mock API for assertions.\n */\nexport function anExpressResponse(): Response {\n const res: Record<string, unknown> = {};\n\n const chainable = [\n 'status',\n 'sendStatus',\n 'links',\n 'contentType',\n 'type',\n 'format',\n 'attachment',\n 'set',\n 'header',\n 'clearCookie',\n 'cookie',\n 'location',\n 'vary',\n 'append',\n ];\n\n for (const method of chainable) {\n res[method] = vi.fn().mockReturnValue(res);\n }\n\n res.send = vi.fn().mockReturnValue(res);\n res.json = vi.fn().mockReturnValue(res);\n res.jsonp = vi.fn().mockReturnValue(res);\n res.end = vi.fn().mockReturnValue(res);\n res.sendFile = vi.fn();\n res.download = vi.fn();\n res.redirect = vi.fn();\n res.render = vi.fn();\n res.get = vi.fn();\n res.setHeader = vi.fn().mockReturnValue(res);\n\n res.headersSent = false;\n res.locals = {};\n res.charset = 'utf-8';\n res.app = {};\n res.req = {};\n\n return res as unknown as Response;\n}\n","export { anExpressRequest } from './anExpressRequest';\nexport type { ExpressRequestOverrides } from './anExpressRequest';\nexport { anExpressResponse } from './anExpressResponse';\n"],"mappings":";;;;;;;;;AA4BA,SAAgB,iBAAiB,YAAqC,CAAC,GAAY;CAC/E,OAAO;EACH,UAAU;EACV,QAAQ;EACR,aAAa;EACb,KAAK;EACL,SAAS,CAAC;EACV,MAAM,KAAA;EACN,QAAQ,CAAC;EACT,KAAK,GAAG,IAAI,SAAkB,KAAK,YAAY,MAAM,SAAS,mBAAmB,KAAA,CAAU;EAC3F,GAAG;CACP;AACJ;;;;;;;;;;AC9BA,SAAgB,oBAA8B;CAC1C,MAAM,MAA+B,CAAC;CAmBtC,KAAK,MAAM,UAAU;EAhBjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAGyB,GACzB,IAAI,UAAU,GAAG,GAAG,EAAE,gBAAgB,GAAG;CAG7C,IAAI,OAAO,GAAG,GAAG,EAAE,gBAAgB,GAAG;CACtC,IAAI,OAAO,GAAG,GAAG,EAAE,gBAAgB,GAAG;CACtC,IAAI,QAAQ,GAAG,GAAG,EAAE,gBAAgB,GAAG;CACvC,IAAI,MAAM,GAAG,GAAG,EAAE,gBAAgB,GAAG;CACrC,IAAI,WAAW,GAAG,GAAG;CACrB,IAAI,WAAW,GAAG,GAAG;CACrB,IAAI,WAAW,GAAG,GAAG;CACrB,IAAI,SAAS,GAAG,GAAG;CACnB,IAAI,MAAM,GAAG,GAAG;CAChB,IAAI,YAAY,GAAG,GAAG,EAAE,gBAAgB,GAAG;CAE3C,IAAI,cAAc;CAClB,IAAI,SAAS,CAAC;CACd,IAAI,UAAU;CACd,IAAI,MAAM,CAAC;CACX,IAAI,MAAM,CAAC;CAEX,OAAO;AACX"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export { ModelDataFactory, type GenericModelFactory } from './ModelDataFactory';
|
|
1
|
+
import { n as GenericModelFactory, r as ModelDataFactory } from "../index-49XmDOxW.js";
|
|
2
|
+
export { type GenericModelFactory, ModelDataFactory };
|
package/dist/factories/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { ModelDataFactory } from "../factories-
|
|
2
|
-
|
|
3
|
-
export { ModelDataFactory };
|
|
1
|
+
import { n as ModelDataFactory } from "../factories-qAJouv1I.js";
|
|
2
|
+
export { ModelDataFactory };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { t as __exportAll } from "./chunk-D7D4PA-g.js";
|
|
3
2
|
//#region src/factories/ModelDataFactory.ts
|
|
3
|
+
/**
|
|
4
|
+
* Factory class for generating test data with sequences and defaults.
|
|
5
|
+
*/
|
|
4
6
|
var ModelDataFactory = class {
|
|
7
|
+
model;
|
|
8
|
+
defaults;
|
|
5
9
|
sequence = 0;
|
|
6
10
|
constructor(model, defaults = {}) {
|
|
7
11
|
this.model = model;
|
|
@@ -44,12 +48,10 @@ var ModelDataFactory = class {
|
|
|
44
48
|
return {};
|
|
45
49
|
}
|
|
46
50
|
};
|
|
47
|
-
|
|
48
51
|
//#endregion
|
|
49
52
|
//#region src/factories/index.ts
|
|
50
|
-
var factories_exports = {};
|
|
51
|
-
__export(factories_exports, { ModelDataFactory: () => ModelDataFactory });
|
|
52
|
-
|
|
53
|
+
var factories_exports = /* @__PURE__ */ __exportAll({ ModelDataFactory: () => ModelDataFactory });
|
|
53
54
|
//#endregion
|
|
54
|
-
export { ModelDataFactory, factories_exports };
|
|
55
|
-
|
|
55
|
+
export { ModelDataFactory as n, factories_exports as t };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=factories-qAJouv1I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factories-qAJouv1I.js","names":[],"sources":["../src/factories/ModelDataFactory.ts","../src/factories/index.ts"],"sourcesContent":["export type GenericModelFactory<TInput extends Record<string, unknown> = Record<string, unknown>, TOutput = TInput> = {\n create(data: TInput): TOutput;\n parse(data: unknown): TOutput;\n};\n\n/**\n * Factory class for generating test data with sequences and defaults.\n */\nexport class ModelDataFactory<TModel extends GenericModelFactory<Record<string, unknown>, unknown>> {\n private sequence = 0;\n\n constructor(\n private model: TModel,\n private defaults: Partial<Parameters<TModel['create']>[0]> = {}\n ) {}\n\n /**\n * Build one model instance by merging defaults, sequence defaults, and overrides.\n */\n public build(overrides: Partial<Parameters<TModel['create']>[0]> = {}): ReturnType<TModel['create']> {\n this.sequence++;\n const data = {\n ...this.defaults,\n ...this.sequenceDefaults(),\n ...overrides,\n };\n return this.model.create(data as Parameters<TModel['create']>[0]) as ReturnType<TModel['create']>;\n }\n\n /**\n * Build `count` model instances using shared overrides.\n */\n public buildList(\n count: number,\n overrides: Partial<Parameters<TModel['create']>[0]> = {}\n ): ReturnType<TModel['create']>[] {\n return Array.from({ length: count }, () => this.build(overrides));\n }\n\n /**\n * Reset the internal sequence counter to zero.\n */\n public resetSequence(): void {\n this.sequence = 0;\n }\n\n /**\n * Return the current sequence counter value.\n */\n public getSequence(): number {\n return this.sequence;\n }\n\n /**\n * Hook for subclasses to provide per-sequence default values.\n */\n protected sequenceDefaults(): Partial<Parameters<TModel['create']>[0]> {\n return {};\n }\n}\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { ModelDataFactory, type GenericModelFactory } from './ModelDataFactory';\n"],"mappings":";;;;;AAQA,IAAa,mBAAb,MAAoG;CAIpF;CACA;CAJZ,WAAmB;CAEnB,YACI,OACA,WAA6D,CAAC,GAChE;EAFU,KAAA,QAAA;EACA,KAAA,WAAA;CACT;;;;CAKH,MAAa,YAAsD,CAAC,GAAiC;EACjG,KAAK;EACL,MAAM,OAAO;GACT,GAAG,KAAK;GACR,GAAG,KAAK,iBAAiB;GACzB,GAAG;EACP;EACA,OAAO,KAAK,MAAM,OAAO,IAAuC;CACpE;;;;CAKA,UACI,OACA,YAAsD,CAAC,GACzB;EAC9B,OAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,SAAS,KAAK,MAAM,SAAS,CAAC;CACpE;;;;CAKA,gBAA6B;EACzB,KAAK,WAAW;CACpB;;;;CAKA,cAA6B;EACzB,OAAO,KAAK;CAChB;;;;CAKA,mBAAuE;EACnE,OAAO,CAAC;CACZ;AACJ"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//#region src/factories/ModelDataFactory.d.ts
|
|
2
|
+
type GenericModelFactory<TInput extends Record<string, unknown> = Record<string, unknown>, TOutput = TInput> = {
|
|
3
|
+
create(data: TInput): TOutput;
|
|
4
|
+
parse(data: unknown): TOutput;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Factory class for generating test data with sequences and defaults.
|
|
8
|
+
*/
|
|
9
|
+
declare class ModelDataFactory<TModel extends GenericModelFactory<Record<string, unknown>, unknown>> {
|
|
10
|
+
private model;
|
|
11
|
+
private defaults;
|
|
12
|
+
private sequence;
|
|
13
|
+
constructor(model: TModel, defaults?: Partial<Parameters<TModel['create']>[0]>);
|
|
14
|
+
/**
|
|
15
|
+
* Build one model instance by merging defaults, sequence defaults, and overrides.
|
|
16
|
+
*/
|
|
17
|
+
build(overrides?: Partial<Parameters<TModel['create']>[0]>): ReturnType<TModel['create']>;
|
|
18
|
+
/**
|
|
19
|
+
* Build `count` model instances using shared overrides.
|
|
20
|
+
*/
|
|
21
|
+
buildList(count: number, overrides?: Partial<Parameters<TModel['create']>[0]>): ReturnType<TModel['create']>[];
|
|
22
|
+
/**
|
|
23
|
+
* Reset the internal sequence counter to zero.
|
|
24
|
+
*/
|
|
25
|
+
resetSequence(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Return the current sequence counter value.
|
|
28
|
+
*/
|
|
29
|
+
getSequence(): number;
|
|
30
|
+
/**
|
|
31
|
+
* Hook for subclasses to provide per-sequence default values.
|
|
32
|
+
*/
|
|
33
|
+
protected sequenceDefaults(): Partial<Parameters<TModel['create']>[0]>;
|
|
34
|
+
}
|
|
35
|
+
declare namespace index_d_exports {
|
|
36
|
+
export { GenericModelFactory, ModelDataFactory };
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { GenericModelFactory as n, ModelDataFactory as r, index_d_exports as t };
|
|
40
|
+
//# sourceMappingURL=index-49XmDOxW.d.ts.map
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { Adapter, AdapterConfig, DBClient, QuerySet, TangoRuntime } from "@danceroutine/tango-orm";
|
|
2
|
+
import { TableMeta } from "@danceroutine/tango-orm/query";
|
|
3
|
+
import { MigrationRunner } from "@danceroutine/tango-migrations";
|
|
4
|
+
import { TangoConfig } from "@danceroutine/tango-config";
|
|
5
|
+
import { spawn } from "node:child_process";
|
|
6
|
+
|
|
7
|
+
//#region src/integration/domain/Dialect.d.ts
|
|
8
|
+
declare const Dialect$1: {
|
|
9
|
+
readonly Sqlite: "sqlite";
|
|
10
|
+
readonly Postgres: "postgres";
|
|
11
|
+
};
|
|
12
|
+
type Dialect$1 = (typeof Dialect$1)[keyof typeof Dialect$1];
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/integration/domain/ResetMode.d.ts
|
|
15
|
+
declare const ResetMode: {
|
|
16
|
+
readonly Transaction: "transaction";
|
|
17
|
+
readonly Truncate: "truncate";
|
|
18
|
+
readonly DropSchema: "drop-schema";
|
|
19
|
+
};
|
|
20
|
+
type ResetMode = (typeof ResetMode)[keyof typeof ResetMode];
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/integration/domain/IntegrationHarness.d.ts
|
|
23
|
+
interface DialectTestCapabilities {
|
|
24
|
+
transactionalDDL: boolean;
|
|
25
|
+
supportsSchemas: boolean;
|
|
26
|
+
supportsConcurrentIndex: boolean;
|
|
27
|
+
supportsDeferredFkValidation: boolean;
|
|
28
|
+
supportsJsonb: boolean;
|
|
29
|
+
}
|
|
30
|
+
interface IntegrationHarness {
|
|
31
|
+
readonly dialect: Dialect$1 | string;
|
|
32
|
+
readonly adapter: Adapter;
|
|
33
|
+
readonly capabilities: DialectTestCapabilities;
|
|
34
|
+
readonly resetMode: ResetMode;
|
|
35
|
+
readonly dbClient: DBClient;
|
|
36
|
+
setup(): Promise<void>;
|
|
37
|
+
reset(): Promise<void>;
|
|
38
|
+
teardown(): Promise<void>;
|
|
39
|
+
migrationRunner(migrationsDir: string): MigrationRunner;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/integration/domain/HarnessStrategy.d.ts
|
|
43
|
+
interface HarnessOptions {
|
|
44
|
+
config?: Partial<AdapterConfig>;
|
|
45
|
+
tangoConfigLoader?: () => unknown;
|
|
46
|
+
resetMode?: ResetMode;
|
|
47
|
+
schema?: string;
|
|
48
|
+
sqliteFile?: string;
|
|
49
|
+
}
|
|
50
|
+
interface HarnessStrategy {
|
|
51
|
+
readonly dialect: Dialect$1 | string;
|
|
52
|
+
readonly capabilities: DialectTestCapabilities;
|
|
53
|
+
create(options?: HarnessOptions): Promise<IntegrationHarness>;
|
|
54
|
+
}
|
|
55
|
+
declare namespace index_d_exports$5 {
|
|
56
|
+
export { Dialect$1 as Dialect, DialectTestCapabilities, HarnessOptions, HarnessStrategy, IntegrationHarness, ResetMode };
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/integration/migrations/AssertMigrationPlan.d.ts
|
|
60
|
+
type AssertMigrationPlanOptions = {
|
|
61
|
+
migrationsDir: string;
|
|
62
|
+
expectSqlContains?: string[];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Generate a migration plan through a harness and assert that required SQL fragments appear.
|
|
66
|
+
*/
|
|
67
|
+
declare function assertMigrationPlan(harness: IntegrationHarness, options: AssertMigrationPlanOptions): Promise<string>;
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/integration/migrations/ApplyAndVerifyMigrations.d.ts
|
|
70
|
+
type ApplyAndVerifyMigrationsOptions = {
|
|
71
|
+
migrationsDir: string;
|
|
72
|
+
toId?: string;
|
|
73
|
+
expectedAppliedIds?: string[];
|
|
74
|
+
};
|
|
75
|
+
type MigrationStatus = {
|
|
76
|
+
id: string;
|
|
77
|
+
applied: boolean;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Apply migrations through a harness and optionally verify that specific ids were applied.
|
|
81
|
+
*/
|
|
82
|
+
declare function applyAndVerifyMigrations(harness: IntegrationHarness, options: ApplyAndVerifyMigrationsOptions): Promise<{
|
|
83
|
+
statuses: MigrationStatus[];
|
|
84
|
+
}>;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/integration/migrations/IntrospectSchema.d.ts
|
|
87
|
+
/**
|
|
88
|
+
* Introspect the schema visible to a harness using Tango's built-in introspectors.
|
|
89
|
+
*/
|
|
90
|
+
declare function introspectSchema(harness: IntegrationHarness): Promise<unknown>;
|
|
91
|
+
declare namespace index_d_exports$4 {
|
|
92
|
+
export { ApplyAndVerifyMigrationsOptions, AssertMigrationPlanOptions, MigrationStatus, applyAndVerifyMigrations, assertMigrationPlan, introspectSchema };
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/integration/conformance/runDialectConformanceSuite.d.ts
|
|
96
|
+
/**
|
|
97
|
+
* Shared conformance checks every harness strategy must satisfy.
|
|
98
|
+
*
|
|
99
|
+
* This is intentionally framework-agnostic so first-party and third-party
|
|
100
|
+
* strategies can run the same lifecycle validation.
|
|
101
|
+
*/
|
|
102
|
+
declare function runDialectConformanceSuite(strategy: HarnessStrategy, options?: {
|
|
103
|
+
createOptions?: HarnessOptions;
|
|
104
|
+
migrationsDir?: string;
|
|
105
|
+
}): Promise<void>;
|
|
106
|
+
declare namespace index_d_exports$3 {
|
|
107
|
+
export { runDialectConformanceSuite };
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/integration/runtime/aTangoConfig.d.ts
|
|
111
|
+
type TestTangoConfigOptions = {
|
|
112
|
+
adapter?: 'sqlite' | 'postgres';
|
|
113
|
+
sqliteFilename?: string;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Create a stable Tango config fixture for runtime-oriented tests.
|
|
117
|
+
*/
|
|
118
|
+
declare function aTangoConfig(options?: TestTangoConfigOptions): TangoConfig;
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/integration/runtime/aTangoRuntime.d.ts
|
|
121
|
+
/**
|
|
122
|
+
* Create a standalone Tango runtime for tests without mutating the process-default runtime.
|
|
123
|
+
*/
|
|
124
|
+
declare function aTangoRuntime(options?: TestTangoConfigOptions): TangoRuntime;
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/integration/runtime/setupTestTangoRuntime.d.ts
|
|
127
|
+
/**
|
|
128
|
+
* Reset and initialize the process-default Tango runtime for tests.
|
|
129
|
+
*/
|
|
130
|
+
declare function setupTestTangoRuntime(options?: TestTangoConfigOptions): Promise<TangoRuntime>;
|
|
131
|
+
declare namespace index_d_exports$2 {
|
|
132
|
+
export { TestTangoConfigOptions, aTangoConfig, aTangoRuntime, setupTestTangoRuntime };
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/integration/smoke/AppProcessHarness.d.ts
|
|
136
|
+
interface AppProcessHarnessOptions {
|
|
137
|
+
command: string;
|
|
138
|
+
args?: string[];
|
|
139
|
+
cwd?: string;
|
|
140
|
+
env?: Record<string, string | undefined>;
|
|
141
|
+
baseUrl: string;
|
|
142
|
+
readyPath?: string;
|
|
143
|
+
readyTimeoutMs?: number;
|
|
144
|
+
readyIntervalMs?: number;
|
|
145
|
+
stopTimeoutMs?: number;
|
|
146
|
+
}
|
|
147
|
+
type FetchLike = typeof fetch;
|
|
148
|
+
type ProcessHarnessOutputStream = {
|
|
149
|
+
on(eventName: 'data', listener: (chunk: unknown) => void): unknown;
|
|
150
|
+
};
|
|
151
|
+
type ProcessHarnessChild = {
|
|
152
|
+
exitCode: number | null;
|
|
153
|
+
killed: boolean;
|
|
154
|
+
kill(signal?: NodeJS.Signals): boolean;
|
|
155
|
+
off(eventName: 'exit', listener: () => void): unknown;
|
|
156
|
+
once(eventName: 'exit', listener: () => void): unknown;
|
|
157
|
+
stdout?: ProcessHarnessOutputStream | null;
|
|
158
|
+
stderr?: ProcessHarnessOutputStream | null;
|
|
159
|
+
};
|
|
160
|
+
interface AppProcessHarnessDeps {
|
|
161
|
+
spawnProcess: (command: string, args?: readonly string[], options?: Parameters<typeof spawn>[2]) => ProcessHarnessChild;
|
|
162
|
+
fetchImpl: FetchLike;
|
|
163
|
+
sleep: (ms: number) => Promise<void>;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Lightweight process harness for end-to-end smoke tests that need a real app process.
|
|
167
|
+
*/
|
|
168
|
+
declare class AppProcessHarness {
|
|
169
|
+
static readonly BRAND: "tango.testing.app_process_harness";
|
|
170
|
+
readonly __tangoBrand: typeof AppProcessHarness.BRAND;
|
|
171
|
+
private readonly child;
|
|
172
|
+
private readonly baseUrl;
|
|
173
|
+
private readonly readyUrl;
|
|
174
|
+
private readonly readyTimeoutMs;
|
|
175
|
+
private readonly readyIntervalMs;
|
|
176
|
+
private readonly stopTimeoutMs;
|
|
177
|
+
private readonly deps;
|
|
178
|
+
private stopped;
|
|
179
|
+
private stdoutBuffer;
|
|
180
|
+
private stderrBuffer;
|
|
181
|
+
private constructor();
|
|
182
|
+
/**
|
|
183
|
+
* Narrow an unknown value to the smoke-test harness that owns a child process.
|
|
184
|
+
*/
|
|
185
|
+
static isAppProcessHarness(value: unknown): value is AppProcessHarness;
|
|
186
|
+
/**
|
|
187
|
+
* Spawn the target process and wait until its readiness endpoint responds successfully.
|
|
188
|
+
*/
|
|
189
|
+
static start(options: AppProcessHarnessOptions, deps?: Partial<AppProcessHarnessDeps>): Promise<AppProcessHarness>;
|
|
190
|
+
/**
|
|
191
|
+
* Return the buffered stdout log for recent process output.
|
|
192
|
+
*/
|
|
193
|
+
getStdoutLog(): string;
|
|
194
|
+
/**
|
|
195
|
+
* Return the buffered stderr log for recent process output.
|
|
196
|
+
*/
|
|
197
|
+
getStderrLog(): string;
|
|
198
|
+
/**
|
|
199
|
+
* Return stdout and stderr in a single formatted string for debugging failures.
|
|
200
|
+
*/
|
|
201
|
+
getCombinedLog(): string;
|
|
202
|
+
/**
|
|
203
|
+
* Issue an HTTP request against the managed application process.
|
|
204
|
+
*/
|
|
205
|
+
request(path: string, init?: RequestInit): Promise<Response>;
|
|
206
|
+
/**
|
|
207
|
+
* Assert an HTTP response status and include process logs when it mismatches.
|
|
208
|
+
*/
|
|
209
|
+
assertResponseStatus(response: Response, expectedStatus: number, label: string): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Stop the managed process, escalating from SIGTERM to SIGKILL when necessary.
|
|
212
|
+
*/
|
|
213
|
+
stop(): Promise<void>;
|
|
214
|
+
private waitForReady;
|
|
215
|
+
private waitForExit;
|
|
216
|
+
}
|
|
217
|
+
declare namespace index_d_exports$1 {
|
|
218
|
+
export { AppProcessHarness, AppProcessHarnessOptions };
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/integration/anIntegrationHarness.d.ts
|
|
222
|
+
/**
|
|
223
|
+
* Create an integration-harness fixture with optional overrides.
|
|
224
|
+
*/
|
|
225
|
+
declare function anIntegrationHarness(overrides?: Partial<IntegrationHarness>): IntegrationHarness;
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/integration/HarnessStrategyRegistry.d.ts
|
|
228
|
+
/**
|
|
229
|
+
* Registry of test harness strategies keyed by dialect.
|
|
230
|
+
*/
|
|
231
|
+
declare class HarnessStrategyRegistry {
|
|
232
|
+
static readonly BRAND: "tango.testing.harness_strategy_registry";
|
|
233
|
+
readonly __tangoBrand: typeof HarnessStrategyRegistry.BRAND;
|
|
234
|
+
private readonly strategies;
|
|
235
|
+
/**
|
|
236
|
+
* Narrow an unknown value to `HarnessStrategyRegistry`.
|
|
237
|
+
*/
|
|
238
|
+
static isHarnessStrategyRegistry(value: unknown): value is HarnessStrategyRegistry;
|
|
239
|
+
/**
|
|
240
|
+
* Register or replace a dialect strategy.
|
|
241
|
+
*/
|
|
242
|
+
register(strategy: HarnessStrategy): this;
|
|
243
|
+
/**
|
|
244
|
+
* Resolve a strategy for a dialect, or throw if none is registered.
|
|
245
|
+
*/
|
|
246
|
+
get(dialect: Dialect$1 | string): HarnessStrategy;
|
|
247
|
+
/**
|
|
248
|
+
* List all registered strategies.
|
|
249
|
+
*/
|
|
250
|
+
list(): readonly HarnessStrategy[];
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/integration/TestHarness.d.ts
|
|
254
|
+
/**
|
|
255
|
+
* Facade for creating integration test harnesses by dialect.
|
|
256
|
+
*/
|
|
257
|
+
declare class TestHarness {
|
|
258
|
+
static readonly BRAND: "tango.testing.test_harness";
|
|
259
|
+
private static defaultRegistry;
|
|
260
|
+
readonly __tangoBrand: typeof TestHarness.BRAND;
|
|
261
|
+
/**
|
|
262
|
+
* Narrow an unknown value to `TestHarness`.
|
|
263
|
+
*/
|
|
264
|
+
static isTestHarness(value: unknown): value is TestHarness;
|
|
265
|
+
/**
|
|
266
|
+
* Register a harness strategy on the shared default registry.
|
|
267
|
+
*/
|
|
268
|
+
static registerStrategy(strategy: HarnessStrategy): void;
|
|
269
|
+
/**
|
|
270
|
+
* Return the shared harness strategy registry.
|
|
271
|
+
*/
|
|
272
|
+
static getRegistry(): HarnessStrategyRegistry;
|
|
273
|
+
/**
|
|
274
|
+
* Create a dialect-specific harness from the registry.
|
|
275
|
+
*/
|
|
276
|
+
static forDialect(args: {
|
|
277
|
+
dialect: Dialect$1 | string;
|
|
278
|
+
options?: HarnessOptions;
|
|
279
|
+
}, registry?: HarnessStrategyRegistry): Promise<IntegrationHarness>;
|
|
280
|
+
/**
|
|
281
|
+
* Convenience helper for a SQLite test harness.
|
|
282
|
+
*/
|
|
283
|
+
static sqlite(options?: HarnessOptions): Promise<IntegrationHarness>;
|
|
284
|
+
/**
|
|
285
|
+
* Convenience helper for a Postgres test harness.
|
|
286
|
+
*/
|
|
287
|
+
static postgres(options?: HarnessOptions): Promise<IntegrationHarness>;
|
|
288
|
+
private static ensureRegistry;
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region src/integration/orm/seedTable.d.ts
|
|
292
|
+
/**
|
|
293
|
+
* Seed rows directly into a table for integration tests that need known fixtures.
|
|
294
|
+
*/
|
|
295
|
+
declare function seedTable<T extends Record<string, unknown>>(harness: IntegrationHarness, table: string, rows: T[]): Promise<void>;
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/integration/orm/createModelQuerySetFixture.d.ts
|
|
298
|
+
/**
|
|
299
|
+
* Create a `ModelQuerySet` fixture backed by a real integration harness and supplied table metadata.
|
|
300
|
+
*/
|
|
301
|
+
declare function createModelQuerySetFixture<TModel extends Record<string, unknown>>(input: {
|
|
302
|
+
harness: IntegrationHarness;
|
|
303
|
+
meta: TableMeta;
|
|
304
|
+
}): QuerySet<TModel>;
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/integration/orm/createQuerySetFixture.d.ts
|
|
307
|
+
/**
|
|
308
|
+
* @deprecated Use `createModelQuerySetFixture(...)` instead.
|
|
309
|
+
*/
|
|
310
|
+
declare function createQuerySetFixture<TModel extends Record<string, unknown>>(input: {
|
|
311
|
+
harness: IntegrationHarness;
|
|
312
|
+
meta: TableMeta;
|
|
313
|
+
}): QuerySet<TModel>;
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region src/integration/orm/expectQueryResult.d.ts
|
|
316
|
+
/**
|
|
317
|
+
* Assert that a query result matches an expected value using structural equality.
|
|
318
|
+
*/
|
|
319
|
+
declare function expectQueryResult<T>(actual: Promise<T> | T, expected: T): Promise<void>;
|
|
320
|
+
declare namespace index_d_exports {
|
|
321
|
+
export { AppProcessHarness, AppProcessHarnessOptions, ApplyAndVerifyMigrationsOptions, AssertMigrationPlanOptions, Dialect$1 as Dialect, DialectTestCapabilities, HarnessOptions, HarnessStrategy, HarnessStrategyRegistry, IntegrationHarness, MigrationStatus, ResetMode, TestHarness, TestTangoConfigOptions, aTangoConfig, aTangoRuntime, anIntegrationHarness, applyAndVerifyMigrations, assertMigrationPlan, index_d_exports$3 as conformance, createModelQuerySetFixture, createQuerySetFixture, index_d_exports$5 as domain, expectQueryResult, introspectSchema, index_d_exports$4 as migrations, runDialectConformanceSuite, index_d_exports$2 as runtime, seedTable, setupTestTangoRuntime, index_d_exports$1 as smoke };
|
|
322
|
+
}
|
|
323
|
+
//#endregion
|
|
324
|
+
export { IntegrationHarness as A, applyAndVerifyMigrations as C, HarnessOptions as D, index_d_exports$5 as E, Dialect$1 as M, HarnessStrategy as O, MigrationStatus as S, assertMigrationPlan as T, index_d_exports$3 as _, seedTable as a, introspectSchema as b, anIntegrationHarness as c, AppProcessHarnessOptions as d, index_d_exports$2 as f, aTangoConfig as g, TestTangoConfigOptions as h, createModelQuerySetFixture as i, ResetMode as j, DialectTestCapabilities as k, index_d_exports$1 as l, aTangoRuntime as m, expectQueryResult as n, TestHarness as o, setupTestTangoRuntime as p, createQuerySetFixture as r, HarnessStrategyRegistry as s, index_d_exports as t, AppProcessHarness as u, runDialectConformanceSuite as v, AssertMigrationPlanOptions as w, ApplyAndVerifyMigrationsOptions as x, index_d_exports$4 as y };
|
|
325
|
+
//# sourceMappingURL=index-B4H3wYuR.d.ts.map
|