@rsdk/testing 2.0.0 → 2.3.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.3.1](https://github.com/R-Vision/rsdk/compare/v2.3.0...v2.3.1) (2023-06-08)
7
+
8
+ ### Bug Fixes
9
+
10
+ * testing correct work with metadata ([d1734fa](https://github.com/R-Vision/rsdk/commit/d1734fa093a5bd905cc81a8c480f5ca4e88e0029))
11
+
12
+ # [2.1.0](https://github.com/R-Vision/rsdk/compare/v2.0.0...v2.1.0) (2023-06-06)
13
+
14
+ **Note:** Version bump only for package @rsdk/testing
15
+
6
16
  # [2.0.0](https://github.com/R-Vision/rsdk/compare/v1.0.12...v2.0.0) (2023-06-06)
7
17
 
8
18
  ### Draft
@@ -32,7 +32,7 @@ interface PlatformTestingModuleBuilder
32
32
  compile(options?: Pick<NestApplicationContextOptions, 'snapshot' | 'preview'>): Promise<PlatformTestingModule>;
33
33
  }
34
34
  export declare class PlatformTest {
35
- private readonly context;
35
+ private readonly options;
36
36
  private constructor();
37
37
  /**
38
38
  * Почему нужно использовать инстанс?
@@ -5,9 +5,9 @@ const testing_1 = require("@nestjs/testing");
5
5
  const core_1 = require("@rsdk/core");
6
6
  const platform_testing_module_1 = require("./platform-testing-module");
7
7
  class PlatformTest {
8
- context;
9
- constructor(context) {
10
- this.context = context;
8
+ options;
9
+ constructor(options) {
10
+ this.options = options;
11
11
  }
12
12
  /**
13
13
  * Почему нужно использовать инстанс?
@@ -16,8 +16,7 @@ class PlatformTest {
16
16
  * @param options
17
17
  */
18
18
  static create(options) {
19
- const context = new core_1.PlatformContext(options);
20
- return new PlatformTest(context);
19
+ return new PlatformTest(options);
21
20
  }
22
21
  /**
23
22
  * Аналог метода `Test.createTestingModule`
@@ -26,7 +25,17 @@ class PlatformTest {
26
25
  * @param metadata
27
26
  */
28
27
  createTestingModule(metadata) {
29
- const context = this.context;
28
+ const contextOptions = {
29
+ ...this.options,
30
+ modules: [
31
+ {
32
+ ...metadata,
33
+ module: class TestingModule {
34
+ },
35
+ },
36
+ ],
37
+ };
38
+ const context = new core_1.PlatformContext(contextOptions);
30
39
  const resultMetadata = {
31
40
  ...metadata,
32
41
  imports: [context.getRoot(), ...(metadata.imports ?? [])],
@@ -1 +1 @@
1
- {"version":3,"file":"platform-test.js","sourceRoot":"","sources":["../src/platform-test.ts"],"names":[],"mappings":";;;AAGA,6CAAuC;AAIvC,qCAA6C;AAE7C,uEAAkE;AAiDlE,MAAa,YAAY;IACc;IAArC,YAAqC,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;IAAG,CAAC;IAEjE;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,OAA+B;QAC3C,MAAM,OAAO,GAAG,IAAI,sBAAe,CAAC,OAAO,CAAC,CAAC;QAE7C,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,mBAAmB,CAAC,QAAwB;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC7B,MAAM,cAAc,GAAG;YACrB,GAAG,QAAQ;YACX,OAAO,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;SAC1D,CAAC;QACF;;WAEG;QACH,MAAM,aAAa,GAAG,cAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;QAE/D;;WAEG;QACH,MAAM,eAAe,GAAG,aAAa,CAAC,OAAO,CAAC;QAE9C,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,SAAS,EAAE;YAC9C,KAAK,EAAE,KAAK,WACV,GAAG,IAAiD;gBAEpD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,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O,CAAC;QAE9C,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,SAAS,EAAE;YAC9C,KAAK,EAAE,KAAK,WACV,GAAG,IAAiD;gBAEpD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAElE,OAAO,IAAI,+CAAqB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACtD,CAAC;SACF,CAAC,CAAC;QACH,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE;YACnD,KAAK,EAAE,eAAe,CAAC,IAAI;YAC3B,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;QACH,OAAO,aAAwD,CAAC;IAClE,CAAC;CACF;AA3DD,oCA2DC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdk/testing",
3
- "version": "2.0.0",
3
+ "version": "2.3.1",
4
4
  "license": "Apache License 2.0",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {
@@ -10,7 +10,7 @@
10
10
  "@nestjs/common": "^9.0.0",
11
11
  "@nestjs/core": "^9.0.0",
12
12
  "@nestjs/testing": "^9.0.0",
13
- "@rsdk/core": "^2.0.0"
13
+ "@rsdk/core": "^2.3.1"
14
14
  },
15
- "gitHead": "9fe1395b8e38e1c7b9578dd5eed12e0c57a9087f"
15
+ "gitHead": "4c61ef3439a6595efe335c0b302b64b9ead108ed"
16
16
  }
@@ -57,7 +57,7 @@ interface PlatformTestingModuleBuilder
57
57
  }
58
58
 
59
59
  export class PlatformTest {
60
- private constructor(private readonly context: PlatformContext) {}
60
+ private constructor(private readonly options: PlatformTestingOptions) {}
61
61
 
62
62
  /**
63
63
  * Почему нужно использовать инстанс?
@@ -66,9 +66,7 @@ export class PlatformTest {
66
66
  * @param options
67
67
  */
68
68
  static create(options: PlatformTestingOptions): PlatformTest {
69
- const context = new PlatformContext(options);
70
-
71
- return new PlatformTest(context);
69
+ return new PlatformTest(options);
72
70
  }
73
71
 
74
72
  /**
@@ -78,7 +76,16 @@ export class PlatformTest {
78
76
  * @param metadata
79
77
  */
80
78
  createTestingModule(metadata: ModuleMetadata): PlatformTestingModuleBuilder {
81
- const context = this.context;
79
+ const contextOptions: PlatformOptions = {
80
+ ...this.options,
81
+ modules: [
82
+ {
83
+ ...metadata,
84
+ module: class TestingModule {},
85
+ },
86
+ ],
87
+ };
88
+ const context = new PlatformContext(contextOptions);
82
89
  const resultMetadata = {
83
90
  ...metadata,
84
91
  imports: [context.getRoot(), ...(metadata.imports ?? [])],