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 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:classic', () => {
74
+ describe('profile:builder', () => {
75
75
  // Helps to reset customizations after each test.
76
76
  MockInstance.scope();
77
77
 
78
- // Let's declare TestBed in beforeAll
79
- // instead of beforeEach.
80
- // The code mocks everything in SharedModule
81
- // and provides a mock AuthService.
82
- beforeAll(async () => {
83
- return TestBed.configureTestingModule({
84
- imports: [
85
- MockModule(SharedModule), // mock
86
- ReactiveFormsModule, // real
87
- ],
88
- declarations: [
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(jasmine.any(ProfileComponent));
107
+ ).toEqual(assertion.any(ProfileComponent));
113
108
  });
114
109
 
115
110
  // A test to ensure that the component listens