-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add providers to configureTestingModule (#22)
- Loading branch information
1 parent
7f1dce6
commit 662f135
Showing
6 changed files
with
26 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
import { AppComponent } from './app.component'; | ||
import { render } from '@testing-library/angular'; | ||
import { configureJestSetup } from '@testing-library/angular/jest-utils'; | ||
import { provideMockStore } from '@ngrx/store/testing'; | ||
|
||
configureJestSetup(); | ||
|
||
test(`matches snapshot`, async () => { | ||
const { container } = await render('<app-root></app-root>', { | ||
declarations: [AppComponent], | ||
providers: [provideMockStore()], | ||
}); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
test(`should have a title`, async () => { | ||
const { getByText } = await render('<app-root></app-root>', { | ||
declarations: [AppComponent], | ||
providers: [provideMockStore()], | ||
}); | ||
expect(getByText('Welcome to app!')).toBeDefined(); | ||
}); | ||
|
||
test(`should render title in a h1 tag`, async () => { | ||
const { container } = await render('<app-root></app-root>', { | ||
declarations: [AppComponent], | ||
providers: [provideMockStore()], | ||
}); | ||
expect(container.querySelector('h1').textContent).toContain('Welcome to app!'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { Component } from '@angular/core'; | ||
import { Store } from '@ngrx/store'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.css'] | ||
styleUrls: ['./app.component.css'], | ||
}) | ||
export class AppComponent { | ||
title = 'app'; | ||
|
||
constructor(private store: Store<any>) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters