Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit b89b0e1

Browse files
using npm test now able to test function
1 parent 712c8e8 commit b89b0e1

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
"start:production": "cross-env PORT=3505 env-cmd -f .env.production react-scripts start",
3939
"build": "react-scripts build",
4040
"test": "react-scripts test",
41-
"justTest": "test",
4241
"eject": "react-scripts eject",
4342
"build:production": "env-cmd -f .env.production react-scripts build"
4443
},

src/__tests__/example.test.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import { add } from '../helpers/example';
22

33
test('Adding 1 + 1 equals 2', () => {
4-
expect(add(1, 1)).toBe(2);
4+
expect(add(1, 23)).toBe(24);
5+
});
6+
7+
test('Adding 1 + 1 equals 2', () => {
8+
expect(add(1, '3')).toBe('13');
9+
});
10+
11+
test('Adding 1 + 1 equals 2', () => {
12+
expect(add('6', 5)).toBe('65');
13+
});
14+
15+
test('Adding 1 + 1 equals 2', () => {
16+
expect(add(7)).toBe(8);
517
});

src/helpers/example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export function add(a, b) {
1+
export function add(a, b = 1) {
22
return a + b;
33
}

0 commit comments

Comments
 (0)