@omnitron-dev/testing 0.4.3 → 0.4.5
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/async/index.d.ts +5 -5
- package/dist/async/index.js +5 -5
- package/dist/async/index.js.map +1 -1
- package/dist/async/retry.js.map +1 -1
- package/dist/async/wait.js.map +1 -1
- package/dist/docker/docker-test-manager.js +1 -1
- package/dist/docker/docker-test-manager.js.map +1 -1
- package/dist/docker/redis-manager.js +2 -1
- package/dist/docker/redis-manager.js.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/helpers/assertions.js.map +1 -1
- package/dist/titan/database/database-testing.module.js +2 -9
- package/dist/titan/database/database-testing.module.js.map +1 -1
- package/dist/titan/index.d.ts +5 -5
- package/dist/titan/index.js +3 -3
- package/dist/titan/index.js.map +1 -1
- package/dist/titan/nexus/test-container.js.map +1 -1
- package/dist/titan/pm/mock-process-spawner.js +4 -1
- package/dist/titan/pm/mock-process-spawner.js.map +1 -1
- package/dist/titan/redis-test-utils.js +2 -1
- package/dist/titan/redis-test-utils.js.map +1 -1
- package/dist/titan/test-application.d.ts +2 -2
- package/dist/titan/test-application.js +1 -1
- package/dist/titan/test-application.js.map +1 -1
- package/dist/titan/test-fixtures.js.map +1 -1
- package/dist/titan/test-module.d.ts +2 -1
- package/dist/titan/test-module.js +1 -1
- package/dist/titan/test-module.js.map +1 -1
- package/package.json +5 -5
- package/src/async/index.ts +5 -30
- package/src/async/retry.ts +1 -4
- package/src/async/wait.ts +1 -4
- package/src/docker/docker-test-manager.ts +15 -15
- package/src/docker/redis-manager.ts +7 -2
- package/src/errors.ts +9 -2
- package/src/helpers/assertions.ts +1 -4
- package/src/titan/database/database-testing.module.ts +11 -32
- package/src/titan/index.ts +5 -26
- package/src/titan/nexus/test-container.ts +13 -5
- package/src/titan/pm/mock-process-spawner.ts +6 -1
- package/src/titan/redis-test-utils.ts +3 -2
- package/src/titan/test-application.ts +2 -2
- package/src/titan/test-fixtures.ts +2 -1
- package/src/titan/test-module.ts +2 -1
|
@@ -3,7 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { Container } from '@omnitron-dev/titan/nexus';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
IModule,
|
|
8
|
+
Provider,
|
|
9
|
+
ProviderDefinition,
|
|
10
|
+
Constructor,
|
|
11
|
+
InjectionToken,
|
|
12
|
+
RegistrationOptions,
|
|
13
|
+
} from '@omnitron-dev/titan/nexus';
|
|
7
14
|
|
|
8
15
|
/**
|
|
9
16
|
* Mock provider configuration
|
|
@@ -518,7 +525,10 @@ export class TestContainer extends Container {
|
|
|
518
525
|
/**
|
|
519
526
|
* Add expectation for a spy
|
|
520
527
|
*/
|
|
521
|
-
expect<T>(
|
|
528
|
+
expect<T>(
|
|
529
|
+
token: InjectionToken<T>,
|
|
530
|
+
method: keyof T
|
|
531
|
+
): {
|
|
522
532
|
toBeCalledTimes: (count: number) => void;
|
|
523
533
|
toBeCalledWith: (...args: any[]) => void;
|
|
524
534
|
toBeCalledAtLeast: (count: number) => void;
|
|
@@ -612,9 +622,7 @@ export class TestContainer extends Container {
|
|
|
612
622
|
for (const expectation of expectations) {
|
|
613
623
|
if (!expectation.verify(spy)) {
|
|
614
624
|
const tokenName = typeof token === 'string' ? token : String(token);
|
|
615
|
-
violations.push(
|
|
616
|
-
`Expectation failed for ${tokenName}.${method as string}: ${expectation.getMessage()}`
|
|
617
|
-
);
|
|
625
|
+
violations.push(`Expectation failed for ${tokenName}.${method as string}: ${expectation.getMessage()}`);
|
|
618
626
|
}
|
|
619
627
|
}
|
|
620
628
|
}
|
|
@@ -180,7 +180,12 @@ export class MockWorker extends EventEmitter {
|
|
|
180
180
|
const result = method(...args);
|
|
181
181
|
|
|
182
182
|
// If the method returns a promise, await it
|
|
183
|
-
if (
|
|
183
|
+
if (
|
|
184
|
+
result &&
|
|
185
|
+
typeof result === 'object' &&
|
|
186
|
+
'then' in result &&
|
|
187
|
+
typeof (result as Promise<unknown>).then === 'function'
|
|
188
|
+
) {
|
|
184
189
|
return await (result as Promise<unknown>);
|
|
185
190
|
}
|
|
186
191
|
|
|
@@ -27,8 +27,9 @@ function createTestNullLogger(): ILogger {
|
|
|
27
27
|
child: () => createTestNullLogger(),
|
|
28
28
|
time: () => noop,
|
|
29
29
|
isLevelEnabled: () => false,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
setLevel: noop,
|
|
31
|
+
getLevel: () => 'silent',
|
|
32
|
+
} as unknown as ILogger;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/**
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* in Titan framework tests.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { Application } from '@omnitron-dev/titan';
|
|
8
|
+
import { Application } from '@omnitron-dev/titan/application';
|
|
9
|
+
import type { IApplicationOptions } from '@omnitron-dev/titan/application';
|
|
9
10
|
import { Container } from '@omnitron-dev/titan/nexus';
|
|
10
|
-
import type { IApplicationOptions } from '@omnitron-dev/titan';
|
|
11
11
|
import { Errors } from '@omnitron-dev/titan/errors';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -120,7 +120,8 @@ export const TestConfigs = {
|
|
|
120
120
|
} as ConfigModuleOptions,
|
|
121
121
|
|
|
122
122
|
withValidation: {
|
|
123
|
-
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
124
|
+
schema: TestSchemas.FullConfig as any,
|
|
124
125
|
sources: [
|
|
125
126
|
{
|
|
126
127
|
type: 'object' as const,
|
package/src/titan/test-module.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IModule, ProviderDefinition, InjectionToken } from '@omnitron-dev/titan/nexus';
|
|
2
|
-
import { Application
|
|
2
|
+
import { Application } from '@omnitron-dev/titan/application';
|
|
3
|
+
import type { IApplicationConfig } from '@omnitron-dev/titan/application';
|
|
3
4
|
|
|
4
5
|
// Import TestContainer from local nexus testing utilities (now in this package)
|
|
5
6
|
import { TestContainer, createTestContainer } from './nexus/test-container.js';
|