@fougere/testing 0.19.1-alpha.0 → 0.20.1-alpha.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.
@@ -1,4 +1,5 @@
1
1
  import { type App } from '@fougere/core';
2
+ import '@fougere/adapter-sql';
2
3
  import { type Stub } from '../stub/Stub.js';
3
4
  import type { TestAppOptions } from './TestAppOptions.js';
4
5
  /** An app, plus the doubles standing in front of its ports and the facts it announced. */
@@ -1 +1 @@
1
- {"version":3,"file":"TestApp.d.ts","sourceRoot":"","sources":["../../src/app/TestApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,EAAgB,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,0FAA0F;AAC1F,MAAM,WAAW,OAAQ,SAAQ,GAAG;IAClC,kFAAkF;IAClF,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7D,wDAAwD;IACxD,SAAS,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,GAAG,OAAO,EAAE,CAAC;CACvD;AAED,8DAA8D;AAC9D,wBAAsB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAgD5E"}
1
+ {"version":3,"file":"TestApp.d.ts","sourceRoot":"","sources":["../../src/app/TestApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAgB,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,0FAA0F;AAC1F,MAAM,WAAW,OAAQ,SAAQ,GAAG;IAClC,kFAAkF;IAClF,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAC7D,wDAAwD;IACxD,SAAS,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,GAAG,OAAO,EAAE,CAAC;CACvD;AAED,8DAA8D;AAC9D,wBAAsB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CA+C5E"}
@@ -1,12 +1,12 @@
1
1
  import { migrating } from '@fougere/core';
2
2
  import { boot } from '@fougere/compiler';
3
+ import '@fougere/adapter-sql';
3
4
  import { remoteTransport, resolveStorage } from '@fougere/defaults';
4
5
  import { installStubs } from '../stub/Stub.js';
5
6
  import { scopeOfRun } from '../scope.js';
6
7
  import { lowerFirst } from '@fougere/schema';
7
8
  /** An app to ask questions of, wired the conventional way. */
8
9
  export async function testApp(options = {}) {
9
- const db = { dialect: 'sqlite', path: options.db ?? ':memory:' };
10
10
  // The position is consulted only for what the caller did not state: an explicit `root`
11
11
  // or `fronds` wins, the way a config key wins over a convention everywhere else.
12
12
  const scope = (options.root && options.fronds) ? undefined
@@ -14,7 +14,7 @@ export async function testApp(options = {}) {
14
14
  // One entry per announcement, in order. `Emissions.announce` calls the carrier for
15
15
  // every fact, so this sees them all — including those nobody in this process listens to.
16
16
  const heard = [];
17
- const storage = resolveStorage(db);
17
+ const storage = resolveStorage({ main: { path: options.db ?? ':memory:' } });
18
18
  const app = await boot({
19
19
  onEmit: (fact, payload) => { heard.push({ fact, payload }); },
20
20
  root: options.root ?? scope?.root,
@@ -25,7 +25,7 @@ export async function testApp(options = {}) {
25
25
  // placed elsewhere and a test runs what it declares.
26
26
  config: options.topology ? undefined : { fronds: {} },
27
27
  ...(options.topology ? { remoteTransport: await remoteTransport() } : { remotes: {} }),
28
- db: () => storage,
28
+ storage: () => storage,
29
29
  extensions: [migrating(storage.migrate)],
30
30
  });
31
31
  const doubles = installStubs(app, options.stub ?? []);
@@ -1 +1 @@
1
- {"version":3,"file":"TestApp.js","sourceRoot":"","sources":["../../src/app/TestApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAiB,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,YAAY,EAAa,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAW7C,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAO,GAAmB,EAAE;IACxD,MAAM,EAAE,GAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,IAAI,UAAU,EAAE,CAAC;IAC3E,uFAAuF;IACvF,iFAAiF;IACjF,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;QACxD,CAAC,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,QAAQ,IAAI,eAAe,EAAE,CAAC,CAAC;IAE5D,mFAAmF;IACnF,yFAAyF;IACzF,MAAM,KAAK,GAAyC,EAAE,CAAC;IACvD,MAAM,OAAO,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;IAEnC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC;QACrB,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAA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,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEvE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1F,CAAC;QACD,IAAI,CAAI,IAA0C;YAChD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAY,CAAC,CAAC;YACxC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CACb,UAAW,IAAa,CAAC,IAAI,gDAAiD,IAAa,CAAC,IAAI,OAAO,CACxG,CAAC;YACJ,CAAC;YAED,OAAO,KAAgB,CAAC;QAC1B,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,kEAAkE;AAClE,SAAS,eAAe;IACtB,MAAM,OAAO,GAAG,UAA2D,CAAC;IAE5E,OAAO,OAAO,CAAC,iBAAiB,EAAE,QAAQ,CAAC;AAC7C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fougere/testing",
3
- "version": "0.19.1-alpha.0",
3
+ "version": "0.20.1-alpha.0",
4
4
  "description": "Tests derived from the declaration — cases, stubs and a gradient of realities.",
5
5
  "keywords": [
6
6
  "fougere",
@@ -37,23 +37,23 @@
37
37
  "src"
38
38
  ],
39
39
  "dependencies": {
40
- "@fougere/core": "0.19.1-alpha.0",
41
- "@fougere/container": "0.19.1-alpha.0",
42
- "@fougere/defaults": "0.19.1-alpha.0",
43
- "@fougere/schema": "0.19.1-alpha.0",
40
+ "@fougere/core": "0.20.1-alpha.0",
41
+ "@fougere/container": "0.20.1-alpha.0",
42
+ "@fougere/defaults": "0.20.1-alpha.0",
43
+ "@fougere/schema": "0.20.1-alpha.0",
44
44
  "json-schema-faker": "^0.6.3",
45
- "@fougere/app": "0.19.1-alpha.0",
46
- "@fougere/transport-http": "0.19.1-alpha.0",
47
- "@fougere/compiler": "0.19.1-alpha.0"
45
+ "@fougere/app": "0.20.1-alpha.0",
46
+ "@fougere/transport-http": "0.20.1-alpha.0",
47
+ "@fougere/compiler": "0.20.1-alpha.0"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "vitest": ">=2",
54
- "@fougere/adapter-graphql": "^0.19.1-alpha.0",
55
- "@fougere/adapter-sql": "^0.19.1-alpha.0",
56
- "@fougere/observability": "^0.19.1-alpha.0"
54
+ "@fougere/adapter-graphql": "^0.20.1-alpha.0",
55
+ "@fougere/adapter-sql": "^0.20.1-alpha.0",
56
+ "@fougere/observability": "^0.20.1-alpha.0"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "vitest": {
@@ -62,19 +62,17 @@
62
62
  "@fougere/adapter-graphql": {
63
63
  "optional": true
64
64
  },
65
- "@fougere/adapter-sql": {
66
- "optional": true
67
- },
68
65
  "@fougere/observability": {
69
66
  "optional": true
70
67
  }
71
68
  },
72
69
  "devDependencies": {
73
- "@fougere/adapter-graphql": "0.19.1-alpha.0",
74
- "@fougere/adapter-sql": "0.19.1-alpha.0",
75
- "@fougere/observability": "0.19.1-alpha.0",
76
- "vitest": "^4.1.0",
77
- "better-sqlite3": "^13.0.3"
70
+ "@fougere/adapter-graphql": "0.20.1-alpha.0",
71
+ "@fougere/adapter-rest": "0.20.1-alpha.0",
72
+ "@fougere/adapter-sql": "0.20.1-alpha.0",
73
+ "@fougere/observability": "0.20.1-alpha.0",
74
+ "better-sqlite3": "^13.0.3",
75
+ "vitest": "^4.1.0"
78
76
  },
79
77
  "scripts": {
80
78
  "build": "rm -rf dist && tsc",
@@ -1,6 +1,7 @@
1
1
  import { migrating, type App } from '@fougere/core';
2
2
  import { boot } from '@fougere/compiler';
3
- import { remoteTransport, resolveStorage, type DbConfig } from '@fougere/defaults';
3
+ import '@fougere/adapter-sql';
4
+ import { remoteTransport, resolveStorage } from '@fougere/defaults';
4
5
  import { installStubs, type Stub } from '../stub/Stub.js';
5
6
  import type { Port } from '../stub/Port.js';
6
7
  import { scopeOfRun } from '../scope.js';
@@ -17,7 +18,6 @@ export interface TestApp extends App {
17
18
 
18
19
  /** An app to ask questions of, wired the conventional way. */
19
20
  export async function testApp(options: TestAppOptions = {}): Promise<TestApp> {
20
- const db: DbConfig = { dialect: 'sqlite', path: options.db ?? ':memory:' };
21
21
  // The position is consulted only for what the caller did not state: an explicit `root`
22
22
  // or `fronds` wins, the way a config key wins over a convention everywhere else.
23
23
  const scope = (options.root && options.fronds) ? undefined
@@ -26,7 +26,7 @@ export async function testApp(options: TestAppOptions = {}): Promise<TestApp> {
26
26
  // One entry per announcement, in order. `Emissions.announce` calls the carrier for
27
27
  // every fact, so this sees them all — including those nobody in this process listens to.
28
28
  const heard: { fact: string; payload: unknown }[] = [];
29
- const storage = resolveStorage(db);
29
+ const storage = resolveStorage({ main: { path: options.db ?? ':memory:' } });
30
30
 
31
31
  const app = await boot({
32
32
  onEmit: (fact, payload) => { heard.push({ fact, payload }); },
@@ -38,7 +38,7 @@ export async function testApp(options: TestAppOptions = {}): Promise<TestApp> {
38
38
  // placed elsewhere and a test runs what it declares.
39
39
  config: options.topology ? undefined : { fronds: {} },
40
40
  ...(options.topology ? { remoteTransport: await remoteTransport() } : { remotes: {} }),
41
- db: () => storage,
41
+ storage: () => storage,
42
42
  extensions: [migrating(storage.migrate)],
43
43
  });
44
44