forked from angular/angular-phonecat
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
53f2d40
commit 5581eb4
Showing
13 changed files
with
20,379 additions
and
12,638 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'test-file-stub'; |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import 'angular'; | ||
import '../phone-list/phone-list.module'; | ||
import PhoneItems from './PhoneItems'; | ||
import phones from '../phones/phones.json'; | ||
|
||
describe('PhoneItems', () => { | ||
it('should render phone items', () => { | ||
render(<PhoneItems phones={phones} orderProp="age" />); | ||
|
||
const phoneList = screen.getAllByRole('listitem'); | ||
|
||
expect(phoneList).toHaveLength(20); | ||
expect(phoneList[0]).toHaveTextContent('Motorola XOOM™ with Wi-Fi'); | ||
}); | ||
|
||
it('should render phone items with query', () => { | ||
render(<PhoneItems phones={phones} query="motorola" orderProp="age" />); | ||
|
||
expect(screen.getAllByRole('listitem')).toHaveLength(8); | ||
}); | ||
|
||
it('should render phone items with query and orderProp', () => { | ||
render(<PhoneItems phones={phones} query="motorola" orderProp="name" />); | ||
|
||
const phoneList = screen.getAllByRole('listitem'); | ||
|
||
expect(phoneList).toHaveLength(8); | ||
expect(phoneList[0]).toHaveTextContent('DROID™ 2 Global by Motorola'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import '@testing-library/jest-dom'; | ||
|
||
global.jasmine = true; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module.exports = { | ||
testEnvironment: 'jest-environment-jsdom', | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest', | ||
'^.+\\.(js|jsx)$': 'babel-jest' | ||
}, | ||
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/tests/'], | ||
moduleNameMapper: { | ||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|html)$': | ||
'<rootDir>/__mocks__/fileMock.js', | ||
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js' | ||
}, | ||
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'] | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.