Skip to content

Commit 530eed2

Browse files
authored
Improvements (#12)
1 parent 5bc1187 commit 530eed2

File tree

6 files changed

+55
-21
lines changed

6 files changed

+55
-21
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.coverage
22
.jest
3-
build
3+
dist
44
node_modules

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,15 @@ or run it in watch mode
3535
```
3636
npm run test:watch
3737
```
38+
39+
## References:
40+
41+
- https://www.typescriptlang.org/docs/
42+
- https://www.typescriptlang.org/docs/handbook/intro.html
43+
- https://www.typescriptlang.org/play
44+
- https://kangax.github.io/compat-table/es6/
45+
- https://caniuse.com/
46+
- https://github.com/onionmccabbage/es-ts-Feb-2022
47+
- https://reactivex.io/
48+
- https://rxjs.dev/guide/overview
49+
- https://rxmarbles.com/

src/.DS_Store

6 KB
Binary file not shown.

test/sum.params.ts

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const params = [
2+
{
3+
a: 0,
4+
b: 0,
5+
result: 0
6+
},
7+
{
8+
a: 1,
9+
b: 0,
10+
result: 1
11+
},
12+
{
13+
a: 0,
14+
b: 1,
15+
result: 1
16+
},
17+
{
18+
a: -1,
19+
b: 1,
20+
result: 0
21+
},
22+
{
23+
a: -1,
24+
b: -1,
25+
result: -2
26+
},
27+
]
28+
29+
export default params;

test/sum.test.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import sum from 'src/sum';
2+
import params from './sum.params';
23

3-
test('basic', () => {
4-
const a = 3;
5-
const b = 2;
6-
expect(sum(a, b)).toBe(a + b);
4+
test.each(params)('sum($a, $b) to return $result', ({a, b, result}) => {
5+
expect(sum(a, b)).toBe(result);
76
});

tsconfig.json

+10-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"display": "Custom Config",
24
"compilerOptions": {
5+
"outDir": "dist",
36
"baseUrl": "./",
47
"paths": {
58
"src/*": ["src/*"]
69
},
7-
"target": "es5",
8-
"lib": ["esnext"],
9-
"allowJs": true,
10-
"skipLibCheck": true,
11-
"strict": false,
12-
"forceConsistentCasingInFileNames": true,
13-
"outDir": "build",
14-
"noEmit": false,
15-
"esModuleInterop": true,
16-
"module": "esnext",
17-
"moduleResolution": "node",
10+
"target": "ES2017",
11+
"module": "ESNext",
12+
"moduleResolution": "Node",
1813
"resolveJsonModule": true,
19-
"isolatedModules": true,
20-
"jsx": "preserve",
21-
"incremental": true
14+
"incremental": true,
15+
"esModuleInterop": true
2216
},
2317
"watchOptions": {
2418
// Use native file system events for files and directories
@@ -29,6 +23,6 @@
2923
// when they're updated a lot.
3024
"fallbackPolling": "dynamicPriority"
3125
},
32-
"include": ["next-env.d.ts", "src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
33-
"exclude": ["node_modules"]
26+
"include": ["src/**/*.ts"],
27+
"exclude": ["node_modules", "test/**/*.ts"]
3428
}

0 commit comments

Comments
 (0)