ng-mocks 14.10.1 → 14.12.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/README.md +3 -0
- package/index.d.ts +27 -2
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ The current version of the library **has been tested** and **can be used** with:
|
|
|
15
15
|
|
|
16
16
|
| Angular | ng-mocks | Jasmine | Jest | Ivy |
|
|
17
17
|
| ------: | :------: | :-----: | :--: | :-: |
|
|
18
|
+
| 17 | latest | yes | yes | yes |
|
|
18
19
|
| 16 | latest | yes | yes | yes |
|
|
19
20
|
| 15 | latest | yes | yes | yes |
|
|
20
21
|
| 14 | latest | yes | yes | yes |
|
|
@@ -73,6 +74,8 @@ An example of a spec for a profile edit component.
|
|
|
73
74
|
// cover behavior of the component.
|
|
74
75
|
describe('profile:builder', () => {
|
|
75
76
|
// Helps to reset customizations after each test.
|
|
77
|
+
// Alternatively, you can enable
|
|
78
|
+
// automatic resetting in test.ts.
|
|
76
79
|
MockInstance.scope();
|
|
77
80
|
|
|
78
81
|
// Let's configure TestBed via MockBuilder.
|
package/index.d.ts
CHANGED
|
@@ -303,7 +303,7 @@ export interface IMockBuilder extends Promise<IMockBuilderResult> {
|
|
|
303
303
|
*
|
|
304
304
|
* @see https://ng-mocks.sudo.eu/api/MockBuilder#provide
|
|
305
305
|
*/
|
|
306
|
-
provide(def:
|
|
306
|
+
provide(def: IMockBuilderProvider): this;
|
|
307
307
|
/**
|
|
308
308
|
* .replace() lets substitute declarations.
|
|
309
309
|
* For example, BrowserAnimationsModule with NoopAnimationsModule.
|
|
@@ -312,6 +312,21 @@ export interface IMockBuilder extends Promise<IMockBuilderResult> {
|
|
|
312
312
|
*/
|
|
313
313
|
replace(source: AnyType<any>, destination: AnyType<any>, config?: IMockBuilderConfigAll & IMockBuilderConfigModule): this;
|
|
314
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* IMockBuilderExtended
|
|
317
|
+
*
|
|
318
|
+
* @see https://ng-mocks.sudo.eu/api/MockBuilder#extending-mockbuilder
|
|
319
|
+
*/
|
|
320
|
+
export interface IMockBuilderExtended extends IMockBuilder {
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* IMockBuilderProvider
|
|
324
|
+
*
|
|
325
|
+
* A special type to cover providers including EnvironmentProviders.
|
|
326
|
+
*/
|
|
327
|
+
export type IMockBuilderProvider = Provider | {
|
|
328
|
+
ɵbrand: "EnvironmentProviders";
|
|
329
|
+
};
|
|
315
330
|
export type ngMocksMockConfig = {
|
|
316
331
|
config?: IMockBuilderConfig;
|
|
317
332
|
hostBindings?: string[];
|
|
@@ -1117,7 +1132,17 @@ export type MockBuilderParam = string | AnyDeclaration<any> | NgModuleWithProvid
|
|
|
1117
1132
|
*
|
|
1118
1133
|
* @see https://ng-mocks.sudo.eu/api/MockBuilder
|
|
1119
1134
|
*/
|
|
1120
|
-
export declare function MockBuilder(keepDeclaration?: MockBuilderParam | MockBuilderParam[] | null | undefined, itsModuleToMock?: MockBuilderParam | MockBuilderParam[] | null | undefined):
|
|
1135
|
+
export declare function MockBuilder(keepDeclaration?: MockBuilderParam | MockBuilderParam[] | null | undefined, itsModuleToMock?: MockBuilderParam | MockBuilderParam[] | null | undefined): IMockBuilderExtended;
|
|
1136
|
+
export declare namespace MockBuilder {
|
|
1137
|
+
/**
|
|
1138
|
+
* Adds a custom function to MockBuilder
|
|
1139
|
+
*/
|
|
1140
|
+
function extend<K extends keyof IMockBuilderExtended & string>(func: K, callback: (builder: IMockBuilderExtended, parameters: never) => void): void;
|
|
1141
|
+
/**
|
|
1142
|
+
* Removes a custom function from MockBuilder
|
|
1143
|
+
*/
|
|
1144
|
+
function extend<K extends keyof IMockBuilderExtended & string>(func: K): void;
|
|
1145
|
+
}
|
|
1121
1146
|
/**
|
|
1122
1147
|
* MockModule creates a mock module class out of an arbitrary module.
|
|
1123
1148
|
* All declarations, imports, exports and providers will be mocked too.
|