ng-mocks 14.3.1 → 14.3.2
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 +15 -20
- 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 +1 -1
package/README.md
CHANGED
|
@@ -71,28 +71,21 @@ An example of a spec for a profile edit component.
|
|
|
71
71
|
// lastName, and a user can edit them.
|
|
72
72
|
// In the following test suite, we would like to
|
|
73
73
|
// cover behavior of the component.
|
|
74
|
-
describe('profile:
|
|
74
|
+
describe('profile:builder', () => {
|
|
75
75
|
// Helps to reset customizations after each test.
|
|
76
76
|
MockInstance.scope();
|
|
77
77
|
|
|
78
|
-
// Let's
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
MockComponent(AvatarComponent), // mock
|
|
90
|
-
ProfileComponent, // real
|
|
91
|
-
],
|
|
92
|
-
providers: [
|
|
93
|
-
MockProvider(AuthService), // mock
|
|
94
|
-
],
|
|
95
|
-
}).compileComponents();
|
|
78
|
+
// Let's configure TestBed via MockBuilder.
|
|
79
|
+
// The code below says to mock everything in
|
|
80
|
+
// ProfileModule except ProfileComponent and
|
|
81
|
+
// ReactiveFormsModule.
|
|
82
|
+
beforeEach(() => {
|
|
83
|
+
// The result of MockBuilder should be returned.
|
|
84
|
+
// https://ng-mocks.sudo.eu/api/MockBuilder
|
|
85
|
+
return MockBuilder(
|
|
86
|
+
ProfileComponent,
|
|
87
|
+
ProfileModule,
|
|
88
|
+
).keep(ReactiveFormsModule);
|
|
96
89
|
});
|
|
97
90
|
|
|
98
91
|
// A test to ensure that ProfileComponent
|
|
@@ -104,12 +97,14 @@ describe('profile:classic', () => {
|
|
|
104
97
|
// onPush change detection, and creates a
|
|
105
98
|
// wrapper component with a template like
|
|
106
99
|
// <app-root ...allInputs></profile>
|
|
100
|
+
// and renders it.
|
|
101
|
+
// It also respects all lifecycle hooks.
|
|
107
102
|
// https://ng-mocks.sudo.eu/api/MockRender
|
|
108
103
|
const fixture = MockRender(ProfileComponent);
|
|
109
104
|
|
|
110
105
|
expect(
|
|
111
106
|
fixture.point.componentInstance,
|
|
112
|
-
).toEqual(
|
|
107
|
+
).toEqual(assertion.any(ProfileComponent));
|
|
113
108
|
});
|
|
114
109
|
|
|
115
110
|
// A test to ensure that the component listens
|