@cosmicdrift/kumiko-testing 0.378.0 → 0.379.0
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/package.json +6 -6
- package/src/helpers/db-cleanup.ts +6 -1
- package/src/helpers/seed.ts +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.379.0",
|
|
4
4
|
"description": "Test template for Kumiko apps: per-flow seedTenant, app test stack, canonical test preloads, bunfig generator and integration runner.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -99,9 +99,9 @@
|
|
|
99
99
|
"kumiko-testing": "./bin/kumiko-testing.ts"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
103
|
-
"@cosmicdrift/kumiko-guards": "0.
|
|
104
|
-
"@cosmicdrift/kumiko-types": "0.
|
|
102
|
+
"@cosmicdrift/kumiko-framework": "0.379.0",
|
|
103
|
+
"@cosmicdrift/kumiko-guards": "0.379.0",
|
|
104
|
+
"@cosmicdrift/kumiko-types": "0.379.0",
|
|
105
105
|
"zod": "^4.4.3"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
@@ -125,8 +125,8 @@
|
|
|
125
125
|
}
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
129
|
-
"@cosmicdrift/kumiko-dev-server": "0.
|
|
128
|
+
"@cosmicdrift/kumiko-bundled-features": "0.379.0",
|
|
129
|
+
"@cosmicdrift/kumiko-dev-server": "0.379.0",
|
|
130
130
|
"@happy-dom/global-registrator": "^20.11.2",
|
|
131
131
|
"@playwright/test": "^1.62.1",
|
|
132
132
|
"@testing-library/dom": "^10.4.1",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EntityTableMeta } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { deleteMany } from "@cosmicdrift/kumiko-framework/db";
|
|
3
3
|
import type { AnyDb } from "@cosmicdrift/kumiko-framework/internal/stack-support";
|
|
4
|
+
import { withExecutorManagedWritesForTests } from "@cosmicdrift/kumiko-framework/internal/testing";
|
|
4
5
|
|
|
5
6
|
/** EntityTableMeta, a built table, or a plain table name string. */
|
|
6
7
|
export type ClearableTable = string | { readonly tableName?: string } | unknown;
|
|
@@ -31,7 +32,11 @@ export async function clearTables(db: AnyDb, tables: readonly ClearableTable[]):
|
|
|
31
32
|
// Test-teardown truncate: resolveClearableTable returns `unknown` (string
|
|
32
33
|
// name or table object). The brand-strip cast is the sanctioned bypass —
|
|
33
34
|
// clearing a managed projection between tests is not a production write.
|
|
34
|
-
await deleteMany(
|
|
35
|
+
await deleteMany(
|
|
36
|
+
withExecutorManagedWritesForTests(db),
|
|
37
|
+
resolveClearableTable(table) as EntityTableMeta,
|
|
38
|
+
{},
|
|
39
|
+
);
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
|
package/src/helpers/seed.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
type WhereObject,
|
|
17
17
|
} from "@cosmicdrift/kumiko-framework/db";
|
|
18
18
|
import type { AnyDb } from "@cosmicdrift/kumiko-framework/internal/stack-support";
|
|
19
|
+
import { withExecutorManagedWritesForTests } from "@cosmicdrift/kumiko-framework/internal/testing";
|
|
19
20
|
|
|
20
21
|
type SeedTable = EntityTable | EntityTableMeta;
|
|
21
22
|
|
|
@@ -24,7 +25,7 @@ export function seedRow<TRow = unknown>(
|
|
|
24
25
|
table: SeedTable,
|
|
25
26
|
values: Record<string, unknown>,
|
|
26
27
|
): Promise<TRow | undefined> {
|
|
27
|
-
return insertOne<TRow>(db, table as EntityTableMeta, values);
|
|
28
|
+
return insertOne<TRow>(withExecutorManagedWritesForTests(db), table as EntityTableMeta, values);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export function seedRows<TRow = unknown>(
|
|
@@ -32,7 +33,7 @@ export function seedRows<TRow = unknown>(
|
|
|
32
33
|
table: SeedTable,
|
|
33
34
|
rows: ReadonlyArray<Record<string, unknown>>,
|
|
34
35
|
): Promise<readonly TRow[]> {
|
|
35
|
-
return insertMany<TRow>(db, table as EntityTableMeta, rows);
|
|
36
|
+
return insertMany<TRow>(withExecutorManagedWritesForTests(db), table as EntityTableMeta, rows);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export function updateRows<TRow = unknown>(
|
|
@@ -41,9 +42,14 @@ export function updateRows<TRow = unknown>(
|
|
|
41
42
|
set: Record<string, unknown>,
|
|
42
43
|
where: WhereObject,
|
|
43
44
|
): Promise<readonly TRow[]> {
|
|
44
|
-
return updateMany<TRow>(
|
|
45
|
+
return updateMany<TRow>(
|
|
46
|
+
withExecutorManagedWritesForTests(db),
|
|
47
|
+
table as EntityTableMeta,
|
|
48
|
+
set,
|
|
49
|
+
where,
|
|
50
|
+
);
|
|
45
51
|
}
|
|
46
52
|
|
|
47
53
|
export function deleteRows(db: AnyDb, table: SeedTable, where: WhereObject): Promise<number> {
|
|
48
|
-
return deleteMany(db, table as EntityTableMeta, where);
|
|
54
|
+
return deleteMany(withExecutorManagedWritesForTests(db), table as EntityTableMeta, where);
|
|
49
55
|
}
|