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
<nz-card | |
*ngIf="!hasError" | |
class="w-100" | |
[nzLoading]="!post" | |
[nzTitle]="post?.title" | |
[nzActions]="[actionLike, actionDislike, actionComment]" | |
> | |
<p nz-typography> | |
{{ post?.message }} | |
</p> |
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
Show hidden characters
{ | |
"plugins": ["import"], | |
"extends": [ | |
"plugin:import/errors", | |
"plugin:import/warnings", | |
"plugin:import/typescript", | |
], | |
"rules": { | |
"import/no-unresolved": "off", | |
"import/named": "warn", |
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
"plugins": ["jsx-a11y"], | |
"extends": [ | |
"plugin:jsx-a11y/recommended" | |
], |
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
import { render } from '@testing-library/react'; | |
import { axe } from 'jest-axe'; | |
import React from 'react'; | |
import App from './app'; | |
describe('App', () => { | |
test('should not have accessibility violations', async () => { | |
const { container } = render(<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
import { render } from '@testing-library/react'; | |
import React from 'react'; | |
import { Provider } from 'react-redux'; | |
import configureStore from 'redux-mock-store'; | |
const mockStore = configureStore([]); | |
describe('...', () => { | |
let store; |
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
import { CountriesResponse } from './models/countries-response.interface'; | |
async function getCountries(): Promise<CountriesResponse> { | |
const response = await fetch(...); | |
if (response.ok) { | |
return response.json(); | |
} | |
throw response; | |
} | |
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
import fetchMock from 'jest-fetch-mock'; | |
import { countriesService } from './countries.service'; | |
import { mockCountriesResponse } from './models/countries-response.mock'; | |
describe('Countries Service', () => { | |
afterEach(() => { | |
fetchMock.resetMocks(); | |
}); |
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
import { render } from '@testing-library/react'; | |
import { mockQuotePerLeg } from '@white-label-airline/services/quotes'; | |
import { | |
FetchStatus, | |
initialQuotesState, | |
quotesSlice, | |
} from '@white-label-airline/store'; | |
import { axe } from 'jest-axe'; | |
import React from 'react'; | |
import { Provider } from 'react-redux'; |
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
describe('initial state', () => { | |
beforeEach(() => { | |
store = mockStore({<intial state>}); | |
store.dispatch = jest.fn(); | |
}); | |
it('should show loading spinner'); | |
}); | |
describe('state with success fetch status', () => { | |
beforeEach(() => { |
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
import { mockCountry } from '@white-label-airline/services/countries'; | |
import { FetchStatus } from '../models/fetch-status.enum'; | |
import { countriesSlice } from './countries.slice'; | |
import { initialCountriesState } from './models/countries-state.initial'; | |
describe('Countries Slice', () => { | |
it('should reset state when get countries', () => { | |
const action = countriesSlice.actions.getCountries(); |