Skip to content

Commit c7c9102

Browse files
fix: test bugs
1 parent 8bbd77b commit c7c9102

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- 8
3+
- 14
44
branchs:
55
only:
66
- master

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
124124
],
125125
"testEnvironment": "jsdom",
126-
"testRunner": "D:\\frontend-js\\node_modules\\jest-circus\\runner.js",
126+
"testRunner": "<rootDir>/node_modules/jest-circus/runner.js",
127127
"transform": {
128128
"^.+\\.(js|jsx|mjs|cjs|ts|tsx)$": "<rootDir>/config/jest/babelTransform.js",
129129
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
@@ -136,7 +136,8 @@
136136
"modulePaths": [],
137137
"moduleNameMapper": {
138138
"^react-native$": "react-native-web",
139-
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
139+
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy",
140+
"@/(.*)$": "<rootDir>/src/$1"
140141
},
141142
"moduleFileExtensions": [
142143
"web.js",

src/App.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function App() {
1717
<Route path="/page3" component={PageThree} />
1818
<Route path="/page4" component={PageFour} />
1919
</Switch>
20+
<div>this is app</div>
2021
</div>
2122
);
2223
}

src/tests/App.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { render, screen } from '@testing-library/react';
22
import App from '../App';
3+
import { BrowserRouter as Router } from 'react-router-dom';
34

45
test('renders learn react link', () => {
5-
render(<App />);
6-
const linkElement = screen.getByText(/learn react/i);
6+
render(
7+
<Router>
8+
<App />
9+
</Router>);
10+
const linkElement = screen.getByText(/this is app/i);
711
expect(linkElement).toBeInTheDocument();
812
});

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@
10911091
dependencies:
10921092
regenerator-runtime "^0.13.4"
10931093

1094-
"@babel/runtime@^7.1.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.9.2":
1094+
"@babel/runtime@^7.1.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.9.2":
10951095
version "7.15.3"
10961096
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.3.tgz#2e1c2880ca118e5b2f9988322bd8a7656a32502b"
10971097
integrity sha512-OvwMLqNXkCXSz1kSm58sEsNuhqOx/fKpnUnKnFB5v8uDda5bLNEHNgKPvhDN6IU0LDcnHQ90LlJ0Q6jnyBSIBA==
@@ -5657,6 +5657,13 @@ history@^4.9.0:
56575657
tiny-warning "^1.0.0"
56585658
value-equal "^1.0.1"
56595659

5660+
history@^5.0.1:
5661+
version "5.0.1"
5662+
resolved "https://registry.yarnpkg.com/history/-/history-5.0.1.tgz#de35025ed08bce0db62364b47ebbf9d97b5eb06a"
5663+
integrity sha512-5qC/tFUKfVci5kzgRxZxN5Mf1CV8NmJx9ByaPX0YTLx5Vz3Svh7NYp6eA4CpDq4iA9D0C1t8BNIfvQIrUI3mVw==
5664+
dependencies:
5665+
"@babel/runtime" "^7.7.6"
5666+
56605667
hmac-drbg@^1.0.1:
56615668
version "1.0.1"
56625669
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"

0 commit comments

Comments
 (0)