@fuzdev/fuz_app 0.184.0 → 0.185.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/dist/actions/CLAUDE.md +4 -1
- package/dist/actions/register_action_ws.d.ts +14 -7
- package/dist/actions/register_action_ws.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.d.ts +17 -4
- package/dist/actions/ws_socket_session.d.ts.map +1 -1
- package/dist/actions/ws_socket_session.js +38 -6
- package/dist/auth/CLAUDE.md +7 -4
- package/dist/auth/audit_log_routes.d.ts +1 -1
- package/dist/auth/audit_log_routes.d.ts.map +1 -1
- package/dist/auth/audit_log_routes.js +3 -2
- package/dist/auth/cleanup.d.ts +34 -3
- package/dist/auth/cleanup.d.ts.map +1 -1
- package/dist/auth/cleanup.js +11 -3
- package/dist/http/CLAUDE.md +1 -1
- package/dist/http/pending_effects.d.ts +8 -4
- package/dist/http/pending_effects.d.ts.map +1 -1
- package/dist/http/route_spec.d.ts +3 -3
- package/dist/http/route_spec.d.ts.map +1 -1
- package/dist/realtime/audit_log_sse.d.ts +1 -1
- package/dist/realtime/sse.d.ts +2 -2
- package/dist/realtime/sse.d.ts.map +1 -1
- package/dist/realtime/sse_constants.d.ts +1 -1
- package/dist/realtime/sse_constants.js +1 -1
- package/dist/server/app_server.d.ts +59 -71
- package/dist/server/app_server.d.ts.map +1 -1
- package/dist/server/app_server.js +52 -60
- package/dist/server/shutdown_drain.d.ts +69 -0
- package/dist/server/shutdown_drain.d.ts.map +1 -0
- package/dist/server/shutdown_drain.js +77 -0
- package/dist/testing/CLAUDE.md +73 -41
- package/dist/testing/admin_integration.d.ts +2 -2
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +36 -20
- package/dist/testing/cross_backend/bootstrap_backend.d.ts +3 -1
- package/dist/testing/cross_backend/bootstrap_backend.d.ts.map +1 -1
- package/dist/testing/cross_backend/bootstrap_backend.js +5 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts +10 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.d.ts.map +1 -1
- package/dist/testing/cross_backend/create_dual_spawn_global_setup.js +33 -7
- package/dist/testing/cross_backend/in_process_setup.d.ts +1 -1
- package/dist/testing/cross_backend/in_process_setup.js +1 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.d.ts.map +1 -1
- package/dist/testing/cross_backend/rpc_success_fixtures.js +2 -1
- package/dist/testing/cross_backend/spawn_backend.d.ts +14 -0
- package/dist/testing/cross_backend/spawn_backend.d.ts.map +1 -1
- package/dist/testing/cross_backend/spawn_backend.js +56 -8
- package/dist/testing/cross_backend/spine_suites.d.ts +17 -14
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +33 -13
- package/dist/testing/cross_backend/standard.d.ts +18 -82
- package/dist/testing/cross_backend/standard.d.ts.map +1 -1
- package/dist/testing/cross_backend/standard.js +6 -21
- package/dist/testing/cross_backend/standard_auth.d.ts +74 -0
- package/dist/testing/cross_backend/standard_auth.d.ts.map +1 -0
- package/dist/testing/cross_backend/standard_auth.js +28 -0
- package/dist/testing/cross_backend/standard_bundle.d.ts +48 -0
- package/dist/testing/cross_backend/standard_bundle.d.ts.map +1 -0
- package/dist/testing/cross_backend/standard_bundle.js +43 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +11 -0
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +13 -0
- package/dist/testing/cross_backend/testing_server_bun.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_bun.js +5 -4
- package/dist/testing/cross_backend/testing_server_core.d.ts +16 -3
- package/dist/testing/cross_backend/testing_server_core.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_server_core.js +20 -4
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts +6 -2
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +7 -3
- package/dist/testing/error_coverage.d.ts +5 -0
- package/dist/testing/error_coverage.d.ts.map +1 -1
- package/dist/testing/error_coverage.js +2 -1
- package/dist/testing/integration.d.ts +4 -20
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +49 -79
- package/dist/testing/integration_helpers.d.ts +16 -0
- package/dist/testing/integration_helpers.d.ts.map +1 -1
- package/dist/testing/integration_helpers.js +29 -1
- package/dist/testing/middleware_gate_probes.d.ts +55 -1
- package/dist/testing/middleware_gate_probes.d.ts.map +1 -1
- package/dist/testing/middleware_gate_probes.js +69 -3
- package/dist/testing/test_app.d.ts +3 -2
- package/dist/testing/test_app.d.ts.map +1 -1
- package/dist/testing/test_app.js +5 -4
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
import { describe_standard_integration_tests } from '../integration.js';
|
|
3
|
+
import { describe_standard_admin_integration_tests } from '../admin_integration.js';
|
|
4
|
+
/**
|
|
5
|
+
* Run the standard auth suites against a spawned backend — integration, and
|
|
6
|
+
* admin when `roles` is provided.
|
|
7
|
+
*/
|
|
8
|
+
export const describe_standard_auth_cross_tests = (options) => {
|
|
9
|
+
describe_standard_integration_tests({
|
|
10
|
+
setup_test: options.setup_test,
|
|
11
|
+
surface_source: options.surface_source,
|
|
12
|
+
capabilities: options.capabilities,
|
|
13
|
+
session_cookie_name: options.session_cookie_name,
|
|
14
|
+
rpc_endpoints: options.rpc_endpoints,
|
|
15
|
+
error_coverage_min: options.error_coverage_min,
|
|
16
|
+
check_uncovered_errors: options.check_uncovered_errors
|
|
17
|
+
});
|
|
18
|
+
if (options.roles) {
|
|
19
|
+
describe_standard_admin_integration_tests({
|
|
20
|
+
setup_test: options.setup_test,
|
|
21
|
+
surface_source: options.surface_source,
|
|
22
|
+
session_cookie_name: options.session_cookie_name,
|
|
23
|
+
roles: options.roles,
|
|
24
|
+
rpc_endpoints: options.rpc_endpoints,
|
|
25
|
+
admin_prefix: options.admin_prefix
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* One call wiring the standard suites that run against a spawned backend —
|
|
4
|
+
* the ones whose option shape is `{setup_test, surface_source, capabilities, ...}`
|
|
5
|
+
* and whose bodies fire requests through `fixture.transport` rather than
|
|
6
|
+
* touching the in-process `Backend`, for a consumer wiring them outside
|
|
7
|
+
* `describe_spine_cross_suites`, which registers the two halves apart:
|
|
8
|
+
*
|
|
9
|
+
* - `describe_standard_auth_cross_tests` (`standard_auth.ts`) —
|
|
10
|
+
* `describe_standard_integration_tests`, and
|
|
11
|
+
* `describe_standard_admin_integration_tests` when the consumer supplies a
|
|
12
|
+
* `RoleRegistry`
|
|
13
|
+
* - `describe_standard_cross_tests` (`standard.ts`) —
|
|
14
|
+
* `describe_middleware_gate_tests`, `describe_round_trip_validation`,
|
|
15
|
+
* `describe_rpc_round_trip_tests` and `describe_data_exposure_tests`
|
|
16
|
+
*
|
|
17
|
+
* **Suites omitted** — the ones that don't survive a process boundary,
|
|
18
|
+
* documented here so per-consumer files don't have to repeat the
|
|
19
|
+
* bookkeeping:
|
|
20
|
+
*
|
|
21
|
+
* - `describe_rate_limiting_tests` — builds a fresh `TestApp` per test to
|
|
22
|
+
* inject tight per-test rate-limiter overrides. That path requires
|
|
23
|
+
* in-process construction of `Backend` + rate limiter; the spawned
|
|
24
|
+
* binary has neither knob nor restart-per-test budget.
|
|
25
|
+
* - `describe_audit_completeness_tests` — reaches into FK-structural
|
|
26
|
+
* introspection that only the in-process backend exposes. Wire-level
|
|
27
|
+
* audit observability lives in the consumer's own audit `.cross.test.ts`
|
|
28
|
+
* driving `audit_log_list` / `audit_log_role_grant_history`.
|
|
29
|
+
*
|
|
30
|
+
* @module
|
|
31
|
+
*/
|
|
32
|
+
import { type StandardCrossTestOptions } from './standard.js';
|
|
33
|
+
import { type StandardAuthCrossTestOptions } from './standard_auth.js';
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for `describe_standard_cross_process_tests`: both halves'
|
|
36
|
+
* options — the in-process suites' shared options minus their
|
|
37
|
+
* in-process-only knobs (`create_route_specs`, `rate_limiting_app_options`).
|
|
38
|
+
*/
|
|
39
|
+
export interface StandardCrossProcessTestOptions extends StandardAuthCrossTestOptions, StandardCrossTestOptions {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Run the cross-process standard test bundle — the auth suites (integration,
|
|
43
|
+
* admin when `roles` is provided), then the middleware-gate probes, round
|
|
44
|
+
* trip, RPC round trip and data exposure. See the module doc for the suites
|
|
45
|
+
* omitted and why.
|
|
46
|
+
*/
|
|
47
|
+
export declare const describe_standard_cross_process_tests: (options: StandardCrossProcessTestOptions) => void;
|
|
48
|
+
//# sourceMappingURL=standard_bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard_bundle.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/standard_bundle.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAiC,KAAK,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAEN,KAAK,4BAA4B,EACjC,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,MAAM,WAAW,+BAChB,SAAQ,4BAA4B,EAAE,wBAAwB;CAAG;AAElE;;;;;GAKG;AACH,eAAO,MAAM,qCAAqC,GACjD,SAAS,+BAA+B,KACtC,IAGF,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import '../assert_dev_env.js';
|
|
2
|
+
/**
|
|
3
|
+
* One call wiring the standard suites that run against a spawned backend —
|
|
4
|
+
* the ones whose option shape is `{setup_test, surface_source, capabilities, ...}`
|
|
5
|
+
* and whose bodies fire requests through `fixture.transport` rather than
|
|
6
|
+
* touching the in-process `Backend`, for a consumer wiring them outside
|
|
7
|
+
* `describe_spine_cross_suites`, which registers the two halves apart:
|
|
8
|
+
*
|
|
9
|
+
* - `describe_standard_auth_cross_tests` (`standard_auth.ts`) —
|
|
10
|
+
* `describe_standard_integration_tests`, and
|
|
11
|
+
* `describe_standard_admin_integration_tests` when the consumer supplies a
|
|
12
|
+
* `RoleRegistry`
|
|
13
|
+
* - `describe_standard_cross_tests` (`standard.ts`) —
|
|
14
|
+
* `describe_middleware_gate_tests`, `describe_round_trip_validation`,
|
|
15
|
+
* `describe_rpc_round_trip_tests` and `describe_data_exposure_tests`
|
|
16
|
+
*
|
|
17
|
+
* **Suites omitted** — the ones that don't survive a process boundary,
|
|
18
|
+
* documented here so per-consumer files don't have to repeat the
|
|
19
|
+
* bookkeeping:
|
|
20
|
+
*
|
|
21
|
+
* - `describe_rate_limiting_tests` — builds a fresh `TestApp` per test to
|
|
22
|
+
* inject tight per-test rate-limiter overrides. That path requires
|
|
23
|
+
* in-process construction of `Backend` + rate limiter; the spawned
|
|
24
|
+
* binary has neither knob nor restart-per-test budget.
|
|
25
|
+
* - `describe_audit_completeness_tests` — reaches into FK-structural
|
|
26
|
+
* introspection that only the in-process backend exposes. Wire-level
|
|
27
|
+
* audit observability lives in the consumer's own audit `.cross.test.ts`
|
|
28
|
+
* driving `audit_log_list` / `audit_log_role_grant_history`.
|
|
29
|
+
*
|
|
30
|
+
* @module
|
|
31
|
+
*/
|
|
32
|
+
import { describe_standard_cross_tests } from './standard.js';
|
|
33
|
+
import { describe_standard_auth_cross_tests } from './standard_auth.js';
|
|
34
|
+
/**
|
|
35
|
+
* Run the cross-process standard test bundle — the auth suites (integration,
|
|
36
|
+
* admin when `roles` is provided), then the middleware-gate probes, round
|
|
37
|
+
* trip, RPC round trip and data exposure. See the module doc for the suites
|
|
38
|
+
* omitted and why.
|
|
39
|
+
*/
|
|
40
|
+
export const describe_standard_cross_process_tests = (options) => {
|
|
41
|
+
describe_standard_auth_cross_tests(options);
|
|
42
|
+
describe_standard_cross_tests(options);
|
|
43
|
+
};
|
|
@@ -7,6 +7,17 @@ import type { AppDeps } from '../../auth/deps.js';
|
|
|
7
7
|
import type { AuditEmitter } from '../../auth/audit_emitter.js';
|
|
8
8
|
import type { DaemonTokenState } from '../../auth/daemon_token.js';
|
|
9
9
|
import type { Db } from '../../db/db.js';
|
|
10
|
+
/**
|
|
11
|
+
* Restamps a seeded account's session at the wall clock, run right after the
|
|
12
|
+
* account is seeded. The reset seeds every account in one transaction, where
|
|
13
|
+
* `NOW()` is one instant, so the seeded sessions would tie on `created_at` and
|
|
14
|
+
* a list ordered by it (`admin_session_list`) would break the tie by the
|
|
15
|
+
* random session hash — a different order per run and per spine. Stamped in
|
|
16
|
+
* seed order, they list the same on both. The Rust reset runs this statement
|
|
17
|
+
* byte for byte (`fuz_testing::testing_reset`); the actor twin is
|
|
18
|
+
* `create_test_extra_actor`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const RESET_SESSION_CLOCK_STAMP_SQL = "UPDATE auth_session SET created_at = clock_timestamp() WHERE account_id = $1";
|
|
10
21
|
/**
|
|
11
22
|
* The `_testing_reset` action spec.
|
|
12
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_reset_actions.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_reset_actions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqF9B,OAAO,EAcN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAInE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACl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O,MAAM,+BAA+B,GAC3C,IAAI,EAAE,EACN,YAAY,MAAM,EAClB,SAAS,MAAM,KACb,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAWlD,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,+CAA+C,QAAO,SAGjE,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;CAaF,CAAC;AAkB/C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qCAAqC,GACjD,SAAS,aAAa,CAAC,SAAS,CAAC,EACjC,UAAS,aAAa,CAAC,SAAS,CAAM,KACpC,SASF,CAAC;AAEF,4CAA4C;AAC5C,MAAM,WAAW,2BAA2B;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;IAC9C;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,OAAO,EACb,SAAS,2BAA2B,KAClC,KAAK,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"testing_reset_actions.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_reset_actions.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAqF9B,OAAO,EAcN,KAAK,KAAK,EACV,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAInE,OAAO,KA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AyBG;AACH,eAAO,MAAM,6CAA6C;;;;;;;;;;;;;;;;;;;;CA8BZ,CAAC;AAE/C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,+BAA+B,GAC3C,IAAI,EAAE,EACN,YAAY,MAAM,EAClB,SAAS,MAAM,KACb,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAWlD,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,+CAA+C,QAAO,SAGjE,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;CAaF,CAAC;AAkB/C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qCAAqC,GACjD,SAAS,aAAa,CAAC,SAAS,CAAC,EACjC,UAAS,aAAa,CAAC,SAAS,CAAM,KACpC,SASF,CAAC;AAEF,4CAA4C;AAC5C,MAAM,WAAW,2BAA2B;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,kBAAkB,EAAE,gBAAgB,CAAC;IAC9C;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACxD;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,GAClC,MAAM,OAAO,EACb,SAAS,2BAA2B,KAClC,KAAK,CAAC,SAAS,CAwJjB,CAAC"}
|
|
@@ -105,6 +105,17 @@ const SeededAccountShape = object({
|
|
|
105
105
|
api_token: string,
|
|
106
106
|
session_cookie: string
|
|
107
107
|
});
|
|
108
|
+
/**
|
|
109
|
+
* Restamps a seeded account's session at the wall clock, run right after the
|
|
110
|
+
* account is seeded. The reset seeds every account in one transaction, where
|
|
111
|
+
* `NOW()` is one instant, so the seeded sessions would tie on `created_at` and
|
|
112
|
+
* a list ordered by it (`admin_session_list`) would break the tie by the
|
|
113
|
+
* random session hash — a different order per run and per spine. Stamped in
|
|
114
|
+
* seed order, they list the same on both. The Rust reset runs this statement
|
|
115
|
+
* byte for byte (`fuz_testing::testing_reset`); the actor twin is
|
|
116
|
+
* `create_test_extra_actor`.
|
|
117
|
+
*/
|
|
118
|
+
export const RESET_SESSION_CLOCK_STAMP_SQL = 'UPDATE auth_session SET created_at = clock_timestamp() WHERE account_id = $1';
|
|
108
119
|
/**
|
|
109
120
|
* The `_testing_reset` action spec.
|
|
110
121
|
*
|
|
@@ -782,6 +793,7 @@ export const create_testing_actions = (deps, options) => {
|
|
|
782
793
|
password_value: DEFAULT_TEST_PASSWORD,
|
|
783
794
|
roles: [...new Set([...DEFAULT_TEST_KEEPER_ROLES, ...(input.extra_keeper_roles ?? [])])]
|
|
784
795
|
});
|
|
796
|
+
await ctx.db.query(RESET_SESSION_CLOCK_STAMP_SQL, [keeper.account.id]);
|
|
785
797
|
// 6. Refresh the daemon-token cache so subsequent daemon-token
|
|
786
798
|
// requests resolve to the freshly seeded keeper. The
|
|
787
799
|
// middleware never re-reads the keeper, so the reset sets it —
|
|
@@ -807,6 +819,7 @@ export const create_testing_actions = (deps, options) => {
|
|
|
807
819
|
password_value: spec.password_value ?? DEFAULT_TEST_PASSWORD,
|
|
808
820
|
roles: spec.roles
|
|
809
821
|
});
|
|
822
|
+
await ctx.db.query(RESET_SESSION_CLOCK_STAMP_SQL, [seeded.account.id]);
|
|
810
823
|
extras.push(seeded);
|
|
811
824
|
}
|
|
812
825
|
// 8. Seed any additional keeper actors. Same bootstrap-cradle
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_server_bun.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_bun.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA4B9B,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AA0BlF,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B,QAAO,
|
|
1
|
+
{"version":3,"file":"testing_server_bun.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_bun.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AA4B9B,OAAO,KAAK,EAAe,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AA0BlF,4CAA4C;AAC5C,eAAO,MAAM,0BAA0B,QAAO,oBAoE7C,CAAC"}
|
|
@@ -78,11 +78,12 @@ export const create_bun_testing_adapter = () => {
|
|
|
78
78
|
//
|
|
79
79
|
// So initiate a force-close (`true` drops active connections, no
|
|
80
80
|
// drain) but DON'T await it: awaiting hangs `start_testing_server`'s
|
|
81
|
-
// shutdown forever —
|
|
82
|
-
//
|
|
81
|
+
// shutdown forever — the core's exit never runs, and the spawning
|
|
82
|
+
// harness blocks on a child that never exits (observed as a
|
|
83
83
|
// multi-minute hang needing SIGKILL). The force-close still tears the
|
|
84
|
-
// live sockets down; the
|
|
85
|
-
//
|
|
84
|
+
// live sockets down; the exit the core fires once `built.close()`
|
|
85
|
+
// returns (`0`, or `1` when it gave up) does the real teardown. Node
|
|
86
|
+
// doesn't need this — its
|
|
86
87
|
// `close()` resolves normally. The `.catch` guards a
|
|
87
88
|
// future Bun that rejects rather than hangs; if a future Bun resolves
|
|
88
89
|
// the promise after a server-initiated close, revert to
|
|
@@ -32,6 +32,7 @@ import type { Context, Hono } from 'hono';
|
|
|
32
32
|
import type { UpgradeWebSocket } from 'hono/ws';
|
|
33
33
|
import { type Logger as LoggerType } from '@fuzdev/fuz_util/log.ts';
|
|
34
34
|
import type { RuntimeDeps } from '../../runtime/deps.js';
|
|
35
|
+
import { type ShutdownDrainGivenUp } from '../../server/shutdown_drain.js';
|
|
35
36
|
/**
|
|
36
37
|
* Adapter-built handle to a bound HTTP server.
|
|
37
38
|
*
|
|
@@ -90,7 +91,15 @@ export interface TestingServerAdapter {
|
|
|
90
91
|
pid: number;
|
|
91
92
|
/** Register SIGINT/SIGTERM listeners that invoke `handler` once each. */
|
|
92
93
|
register_shutdown_signals: (handler: () => Promise<void>) => void;
|
|
93
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Forceful exit on graceful-shutdown completion or fatal error: `0` for a
|
|
96
|
+
* shutdown that drained everything, `1` for one that gave up or threw.
|
|
97
|
+
*
|
|
98
|
+
* A give-up's exit still waits for `BuiltTestingApp.close` to return, and
|
|
99
|
+
* that closes the database: on `pg`, `pool.end()` waits for a client a
|
|
100
|
+
* wedged handler holds, so the exit can wait past teardown's SIGKILL. The
|
|
101
|
+
* harness's default databases (pglet, PGlite) have no pool to wait on.
|
|
102
|
+
*/
|
|
94
103
|
exit: (code: number) => never;
|
|
95
104
|
}
|
|
96
105
|
/** What the core hands a `StartTestingServerOptions.build_app` seam. */
|
|
@@ -115,8 +124,10 @@ export interface BuiltTestingApp {
|
|
|
115
124
|
* Tear down backend(s) + DB + any rotation on graceful shutdown. Called
|
|
116
125
|
* after the listener stops accepting connections and before its drain is
|
|
117
126
|
* awaited, so it must end live WebSockets (`AppServer.close` does).
|
|
127
|
+
* Resolves what the shutdown gave up on — `AppServer.close`'s report — and
|
|
128
|
+
* a report that gave up on anything exits the process `1`.
|
|
118
129
|
*/
|
|
119
|
-
close: () => Promise<
|
|
130
|
+
close: () => Promise<ShutdownDrainGivenUp>;
|
|
120
131
|
}
|
|
121
132
|
/** Options for `start_testing_server`. */
|
|
122
133
|
export interface StartTestingServerOptions {
|
|
@@ -159,7 +170,9 @@ export declare const is_loopback_bind_host: (host: string) => boolean;
|
|
|
159
170
|
* Boot a test-mode server using the supplied runtime adapter.
|
|
160
171
|
*
|
|
161
172
|
* Mirrors a production `start_server` at the surface level — stale-daemon
|
|
162
|
-
* check, daemon-info write, bind, graceful shutdown
|
|
173
|
+
* check, daemon-info write, bind, graceful shutdown, exiting `1` when the
|
|
174
|
+
* shutdown gave up on work still running or threw, without waiting for the
|
|
175
|
+
* listener's drain behind a request it gave up on — but the app is the
|
|
163
176
|
* caller's no-domain (or domain) `StartTestingServerOptions.build_app`
|
|
164
177
|
* and the runtime boundary is the `TestingServerAdapter`. Refuses any
|
|
165
178
|
* non-loopback bind host (the test binary must stay on loopback — see
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing_server_core.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_core.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"testing_server_core.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/testing_server_core.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAU,KAAK,MAAM,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE7F;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,4DAA4D;AAC5D,MAAM,WAAW,uBAAuB;IACvC;;;;;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ACpB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACzE,0EAA0E;IAC1E,GAAG,CAAC,EAAE,UAAU,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,OAGpD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAU,SAAS,yBAAyB,KAAG,OAAO,CAAC,IAAI,CAuE3F,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '../assert_dev_env.js';
|
|
2
2
|
import { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
3
3
|
import { write_daemon_info, read_daemon_info, is_daemon_running } from '../daemon_info.js';
|
|
4
|
+
import { shutdown_gave_up } from '../../server/shutdown_drain.js';
|
|
4
5
|
/**
|
|
5
6
|
* Loopback bind hosts — the only ones the test binary may serve on. It ships
|
|
6
7
|
* deterministic dev secrets (fixed cookie keys + bootstrap token in
|
|
@@ -18,7 +19,9 @@ export const is_loopback_bind_host = (host) => {
|
|
|
18
19
|
* Boot a test-mode server using the supplied runtime adapter.
|
|
19
20
|
*
|
|
20
21
|
* Mirrors a production `start_server` at the surface level — stale-daemon
|
|
21
|
-
* check, daemon-info write, bind, graceful shutdown
|
|
22
|
+
* check, daemon-info write, bind, graceful shutdown, exiting `1` when the
|
|
23
|
+
* shutdown gave up on work still running or threw, without waiting for the
|
|
24
|
+
* listener's drain behind a request it gave up on — but the app is the
|
|
22
25
|
* caller's no-domain (or domain) `StartTestingServerOptions.build_app`
|
|
23
26
|
* and the runtime boundary is the `TestingServerAdapter`. Refuses any
|
|
24
27
|
* non-loopback bind host (the test binary must stay on loopback — see
|
|
@@ -60,6 +63,7 @@ export const start_testing_server = async (options) => {
|
|
|
60
63
|
adapter.exit(1);
|
|
61
64
|
shutting_down = true;
|
|
62
65
|
log.info('shutting down...');
|
|
66
|
+
let failed = false;
|
|
63
67
|
try {
|
|
64
68
|
// Stop accepting first so no new request reaches a closed DB, but
|
|
65
69
|
// don't await the drain yet: live WebSockets hold it open until
|
|
@@ -68,13 +72,25 @@ export const start_testing_server = async (options) => {
|
|
|
68
72
|
// in flight when the signal lands is waited for by `AppServer.close`
|
|
69
73
|
// (behind `built.close()`), within its drain bound.
|
|
70
74
|
const drained = server.shutdown();
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
// awaited only on a clean close, below — never left unhandled
|
|
76
|
+
drained.catch(() => { });
|
|
77
|
+
const given_up = await built.close();
|
|
78
|
+
// `AppServer.close` has logged what it gave up on
|
|
79
|
+
failed = shutdown_gave_up(given_up);
|
|
80
|
+
// a request the drain gave up on still holds its connection, which
|
|
81
|
+
// the listener's close would wait on past teardown's SIGKILL — as
|
|
82
|
+
// the Rust spine's one bound covers its listener drain too
|
|
83
|
+
if (!failed)
|
|
84
|
+
await drained;
|
|
73
85
|
}
|
|
74
86
|
catch (error) {
|
|
75
87
|
log.error('shutdown error:', error);
|
|
88
|
+
failed = true;
|
|
76
89
|
}
|
|
77
|
-
|
|
90
|
+
// a shutdown that went wrong is a failed exit, which the cross-backend
|
|
91
|
+
// teardown reports — twin of the Rust spine's
|
|
92
|
+
// `StartupError::ShutdownGivenUp`, which exits 1
|
|
93
|
+
adapter.exit(failed ? 1 : 0);
|
|
78
94
|
};
|
|
79
95
|
adapter.register_shutdown_signals(shutdown);
|
|
80
96
|
};
|
|
@@ -92,8 +92,12 @@ export interface TsSpineBackendConfigOptions {
|
|
|
92
92
|
readonly db_audit_checkout_timeout_ms?: number;
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
* `BackendConfig` for the Node TS spine binary — spawned
|
|
96
|
-
*
|
|
95
|
+
* `BackendConfig` for the Node TS spine binary — spawned on plain Node (type
|
|
96
|
+
* stripping, with the `development` condition the testing modules assert),
|
|
97
|
+
* not under `gro run`: gro's CLI passes a SIGTERM on to the task's process
|
|
98
|
+
* but then dies by the signal itself, without waiting for the server's exit
|
|
99
|
+
* code, so teardown — which holds the spawned process to exit `0` — would see
|
|
100
|
+
* a signal exit whatever the shutdown exited with.
|
|
97
101
|
*/
|
|
98
102
|
export declare const ts_spine_node_backend_config: (options?: TsSpineBackendConfigOptions) => BackendConfig;
|
|
99
103
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts_spine_backend_config.d.ts","sourceRoot":"","sources":["../../../src/lib/testing/cross_backend/ts_spine_backend_config.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA4EzD,6FAA6F;AAC7F,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,gDAAgD;AAChD,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,yDAAyD;AACzD,eAAO,MAAM,mBAAmB,wDAAwD,CAAC;AAEzF,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,uDAAuD,CAAC;AAEvF,MAAM,WAAW,2BAA2B;IAC3C,sEAAsE;IACtE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;OASG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAC5C;;;;;OAKG;IACH,QAAQ,CAAC,8BAA8B,CAAC,EA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AAE,MAAM,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IACzC;;;;OAIG;IACH,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAC/C;AAWD;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,GACxC,UAAS,2BAAgC,KACvC,aAyBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,GACvC,UAAS,2BAAgC,KACvC,aAyBF,CAAC"}
|
|
@@ -76,8 +76,12 @@ export const TS_SPINE_BUN_ENTRY = 'src/test/cross_backend/testing_spine_server_b
|
|
|
76
76
|
*/
|
|
77
77
|
const login_rate_limit_env = (enable) => enable ? { [LOGIN_RATE_LIMIT_ENABLED_ENV]: 'true' } : {};
|
|
78
78
|
/**
|
|
79
|
-
* `BackendConfig` for the Node TS spine binary — spawned
|
|
80
|
-
*
|
|
79
|
+
* `BackendConfig` for the Node TS spine binary — spawned on plain Node (type
|
|
80
|
+
* stripping, with the `development` condition the testing modules assert),
|
|
81
|
+
* not under `gro run`: gro's CLI passes a SIGTERM on to the task's process
|
|
82
|
+
* but then dies by the signal itself, without waiting for the server's exit
|
|
83
|
+
* code, so teardown — which holds the spawned process to exit `0` — would see
|
|
84
|
+
* a signal exit whatever the shutdown exited with.
|
|
81
85
|
*/
|
|
82
86
|
export const ts_spine_node_backend_config = (options = {}) => {
|
|
83
87
|
const { port = TS_SPINE_NODE_DEFAULT_PORT, database_url, enable_login_rate_limit, name = 'ts_spine_node' } = options;
|
|
@@ -86,7 +90,7 @@ export const ts_spine_node_backend_config = (options = {}) => {
|
|
|
86
90
|
...make_default_ts_backend_config({
|
|
87
91
|
name,
|
|
88
92
|
port,
|
|
89
|
-
start_command: ['
|
|
93
|
+
start_command: ['node', '--conditions=development', TS_SPINE_NODE_ENTRY],
|
|
90
94
|
database_url,
|
|
91
95
|
paths,
|
|
92
96
|
daemon_token_dir_env: TS_SPINE_DIR_ENV,
|
|
@@ -15,6 +15,11 @@ export interface CoverageFilterOptions {
|
|
|
15
15
|
ignore_routes?: Array<string>;
|
|
16
16
|
/** HTTP status codes to skip. */
|
|
17
17
|
ignore_statuses?: Array<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Error codes to skip at any status — the codes another suite owns. A code
|
|
20
|
+
* names one status (`assert_error_code_status_consistency`).
|
|
21
|
+
*/
|
|
22
|
+
ignore_codes?: ReadonlyArray<string>;
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
20
25
|
* Tracks which route × status (and route × status × code) combinations have
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error_coverage.d.ts","sourceRoot":"","sources":["../../src/lib/testing/error_coverage.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAmB7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGlF,gFAAgF;AAChF,MAAM,WAAW,cAAc;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;CACb;AAED,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACrC,kDAAkD;IAClD,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,iCAAiC;IACjC,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"error_coverage.d.ts","sourceRoot":"","sources":["../../src/lib/testing/error_coverage.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAmB7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAuB,KA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QG;IACH,SAAS,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,KAAK,CAAC,cAAc,CAAC;CAKhG;AAED;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,2CAA2C;AAC3C,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IAClE,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAYD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,GACjC,WAAW,sBAAsB,EACjC,aAAa,KAAK,CAAC,SAAS,CAAC,EAC7B,UAAU,oBAAoB,KAC5B,IAsBF,CAAC"}
|
|
@@ -31,6 +31,7 @@ import { find_route_spec, assert_response_matches_spec } from './integration_hel
|
|
|
31
31
|
const walk_coverage = (collector, route_specs, options) => {
|
|
32
32
|
const ignore_routes = new Set(options?.ignore_routes);
|
|
33
33
|
const ignore_statuses = new Set(options?.ignore_statuses);
|
|
34
|
+
const ignore_codes = new Set(options?.ignore_codes);
|
|
34
35
|
const entries = [];
|
|
35
36
|
for (const spec of route_specs) {
|
|
36
37
|
const route_key = format_route_key(spec);
|
|
@@ -39,7 +40,7 @@ const walk_coverage = (collector, route_specs, options) => {
|
|
|
39
40
|
// a code with two shapes at one status is one path
|
|
40
41
|
const seen = new Set();
|
|
41
42
|
for (const { status, code } of get_route_error_map(collector.route_error_maps, spec).defs) {
|
|
42
|
-
if (ignore_statuses.has(status))
|
|
43
|
+
if (ignore_statuses.has(status) || ignore_codes.has(code))
|
|
43
44
|
continue;
|
|
44
45
|
const status_key = `${spec.method} ${spec.path}:${status}`;
|
|
45
46
|
const code_key = `${status_key}:${code}`;
|
|
@@ -55,24 +55,6 @@ export interface StandardIntegrationTestOptions {
|
|
|
55
55
|
* denial-path drivers.
|
|
56
56
|
*/
|
|
57
57
|
error_coverage_min?: number;
|
|
58
|
-
/**
|
|
59
|
-
* Base URL the backend is reachable at, or `null` in-process. The
|
|
60
|
-
* middleware-gate probes write their heads to the socket when there is one
|
|
61
|
-
* (`fetch` replaces a caller's `Host` and `Content-Length`), and go through
|
|
62
|
-
* the fixture's transport when there isn't.
|
|
63
|
-
*/
|
|
64
|
-
base_url: string | null;
|
|
65
|
-
/**
|
|
66
|
-
* The backend's request-body cap on every counted route but the RPC
|
|
67
|
-
* endpoint, in bytes — the body-limit probe declares one byte more.
|
|
68
|
-
* Default `SPINE_BODY_LIMIT_DEFAULT_BYTES`, the spines' default.
|
|
69
|
-
*/
|
|
70
|
-
max_body_bytes?: number;
|
|
71
|
-
/**
|
|
72
|
-
* The backend's request-body cap on the RPC endpoint, in bytes, when it
|
|
73
|
-
* isn't `max_body_bytes`.
|
|
74
|
-
*/
|
|
75
|
-
rpc_max_body_bytes?: number;
|
|
76
58
|
/**
|
|
77
59
|
* Called once the suite's tests have run, with the declared error paths of
|
|
78
60
|
* the counted routes it never observed, before the coverage floor is
|
|
@@ -88,8 +70,10 @@ export interface StandardIntegrationTestOptions {
|
|
|
88
70
|
* revocation, password change (incl. API token revocation), origin
|
|
89
71
|
* verification, bearer auth (incl. browser context discard on mutations),
|
|
90
72
|
* token revocation, cross-account isolation, expired credential rejection,
|
|
91
|
-
* signup invite edge cases, response body validation
|
|
92
|
-
* gates each counted route's error map declares
|
|
73
|
+
* signup invite edge cases, and response body validation. The middleware
|
|
74
|
+
* gates each counted route's error map declares are
|
|
75
|
+
* `describe_middleware_gate_tests`' (`middleware_gate_probes.ts`), a suite of
|
|
76
|
+
* their own since over a socket they write raw request heads.
|
|
93
77
|
*
|
|
94
78
|
* Each test group asserts that required routes exist, failing with a descriptive
|
|
95
79
|
* message if the consumer's route specs are misconfigured.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/lib/testing/integration.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AA8B7B,OAAO,EAKN,KAAK,uBAAuB,EAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAa7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,EAAW,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAKpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAK1D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;;;OAIG;IACH,UAAU,EAAE,SAAS,CAAC;IACtB;;;;;;;;;OASG;IACH,cAAc,EAAE,cAAc,CAAC;IAC/B,kEAAkE;IAClE,YAAY,EAAE,mBAAmB,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,uBAAuB,CAAC;IACvC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,mCAAmC,GAC/C,SAAS,8BAA8B,KACrC,IAg+CF,CAAC"}
|