Skip to content

Commit

Permalink
Merge pull request #3890 from satanTime/issues/docs
Browse files Browse the repository at this point in the history
docs: sync with tests
  • Loading branch information
satanTime authored Oct 22, 2022
2 parents 5b59f34 + 0023317 commit 53b2032
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/articles/extra/extensive-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe('main', () => {
});

it('asserts behavior of AppComponent', () => {
const logoClickSpy = jasmine.createSpy();
const logoClickSpy = jasmine.createSpy(); // or jest.fn();
// in case of jest
// const logoClickSpy = jest.fn();

Expand Down
4 changes: 2 additions & 2 deletions docs/articles/extra/mock-form-controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('MockReactiveForms', () => {
it('sends the correct value to the mock form component', () => {
// That is our spy on writeValue calls.
// With auto spy this code is not needed.
const writeValue = jasmine.createSpy('writeValue');
const writeValue = jasmine.createSpy('writeValue'); // or jest.fn();
// in case of jest
// const writeValue = jest.fn();

Expand Down Expand Up @@ -149,7 +149,7 @@ describe('MockForms', () => {
it('sends the correct value to the mock form component', async () => {
// That is our spy on writeValue calls.
// With auto spy this code is not needed.
const writeValue = jasmine.createSpy('writeValue');
const writeValue = jasmine.createSpy('writeValue'); // or jest.fn();
// in case of jest
// const writeValue = jest.fn();

Expand Down
1 change: 1 addition & 0 deletions docs/articles/guides/http-interceptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import {
MockBuilder,
MockRender,
NG_MOCKS_INTERCEPTORS,
ngMocks,
} from 'ng-mocks';

// An interceptor we want to test.
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/guides/http-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import {
import { Injectable, NgModule } from '@angular/core';
import { Observable } from 'rxjs';

import { MockBuilder, MockRender } from 'ng-mocks';
import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';

// A service that does http requests.
@Injectable()
Expand Down
4 changes: 2 additions & 2 deletions docs/articles/guides/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ describe('TestProviderWithUseClass', () => {
it('respects all dependencies', () => {
const service = MockRender<
Target1Service & Partial<Target2Service>
>(Target1Service).point.componentInstance;
>(Target1Service).point.componentInstance;

// Let's assert that service has a flag from Target2Service.
expect(service.flag).toBeTruthy();
Expand Down Expand Up @@ -397,7 +397,7 @@ describe('TestProviderWithUseExisting', () => {
it('creates TargetService', () => {
const service = MockRender<
TargetService & Partial<{ name: string }>
>(TargetService).point.componentInstance;
>(TargetService).point.componentInstance;

// Because Service2 has been replaced with a mock copy,
// we are getting here a mock copy of Service2 instead of Service1.
Expand Down
7 changes: 5 additions & 2 deletions examples/MockReactiveForms/test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ describe('MockReactiveForms', () => {
MockInstance.scope();

beforeEach(() => {
return MockBuilder(MyComponent, ItsModule).keep(
ReactiveFormsModule,
// DependencyComponent is a declaration in ItsModule.
return (
MockBuilder(MyComponent, ItsModule)
// ReactiveFormsModule is an import in ItsModule.
.keep(ReactiveFormsModule)
);
});

Expand Down

0 comments on commit 53b2032

Please sign in to comment.