jest
This commit is contained in:
@ -2,7 +2,8 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"es2020": true,
|
"es2020": true,
|
||||||
"node": true
|
"node": true,
|
||||||
|
"jest": true
|
||||||
},
|
},
|
||||||
"extends": ["eslint:recommended", "plugin:import/errors", "plugin:import/warnings"],
|
"extends": ["eslint:recommended", "plugin:import/errors", "plugin:import/warnings"],
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
|
|||||||
1
babel.config.js
Normal file
1
babel.config.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
module.exports = {presets: ['@babel/preset-env']};
|
||||||
5
jest.config.js
Normal file
5
jest.config.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
transform: {
|
||||||
|
'^.+\\.(js|jsx)$': 'babel-jest',
|
||||||
|
},
|
||||||
|
};
|
||||||
15530
package-lock.json
generated
Normal file
15530
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,9 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "webpack serve --mode=development",
|
"start": "webpack serve --mode=development",
|
||||||
"dev": "webpack serve --mode=development --open=false",
|
"dev": "webpack serve --mode=development --open=false",
|
||||||
"build": "webpack --mode=production"
|
"build": "webpack --mode=production",
|
||||||
|
"lint": "eslint -c .eslintrc.json src --fix",
|
||||||
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -20,6 +22,8 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/vigdorov/examples-for-kids#readme",
|
"homepage": "https://github.com/vigdorov/examples-for-kids#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/preset-env": "^7.26.9",
|
||||||
|
"babel-jest": "^29.7.0",
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
"css-loader": "^5.0.1",
|
"css-loader": "^5.0.1",
|
||||||
"eslint": "^7.19.0",
|
"eslint": "^7.19.0",
|
||||||
@ -28,6 +32,7 @@
|
|||||||
"favicons-webpack-plugin": "^5.0.1",
|
"favicons-webpack-plugin": "^5.0.1",
|
||||||
"file-loader": "^6.2.0",
|
"file-loader": "^6.2.0",
|
||||||
"html-webpack-plugin": "^5.0.0",
|
"html-webpack-plugin": "^5.0.0",
|
||||||
|
"jest": "^29.7.0",
|
||||||
"mini-css-extract-plugin": "^1.3.5",
|
"mini-css-extract-plugin": "^1.3.5",
|
||||||
"webpack": "^5.21.1",
|
"webpack": "^5.21.1",
|
||||||
"webpack-cli": "^4.5.0",
|
"webpack-cli": "^4.5.0",
|
||||||
|
|||||||
7
src/consts.test.js
Normal file
7
src/consts.test.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import {DIFFICULTY, START_BUTTON_EASY_ID} from './consts';
|
||||||
|
|
||||||
|
describe('getDifficultyById', () => {
|
||||||
|
it('should return correct difficulty', () => {
|
||||||
|
expect(DIFFICULTY[START_BUTTON_EASY_ID]).toBe(10);
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -130,7 +130,7 @@ const getExample = () => {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDifficultyById = id => {
|
export const getDifficultyById = id => {
|
||||||
return DIFFICULTY[id];
|
return DIFFICULTY[id];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user