Skip to content

Commit

Permalink
✅ add basic unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yago committed Aug 10, 2020
1 parent 851abf3 commit ef55b64
Show file tree
Hide file tree
Showing 7 changed files with 2,237 additions and 94 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
"lint:js": "eslint --ext js,jsx,ts,tsx ./ --max-warnings=0",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"jest:start": "jest --watchAll",
"start": "cd playground && node_modules/.bin/next start"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.11.2",
"@testing-library/react": "^10.4.8",
"@testing-library/user-event": "^12.1.0",
"@types/jest": "^26.0.9",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"babel-eslint": "^10.1.0",
Expand All @@ -32,11 +34,13 @@
"eslint-plugin-react-hooks": "^4.0.4",
"eslint-plugin-simple-import-sort": "^5.0.3",
"husky": "^4.2.5",
"jest": "^26.3.0",
"lint-staged": "^10.2.9",
"prettier": "^2.0.5",
"stylelint": "^13.6.0",
"stylelint-config-standard": "^20.0.0",
"stylelint-order": "^4.1.0",
"ts-jest": "^26.1.4",
"typescript": "^3.9.7"
}
}
23 changes: 0 additions & 23 deletions playground/src/components/Blank/Blank.spec.tsx

This file was deleted.

23 changes: 0 additions & 23 deletions playground/src/components/Counter/Counter.spec.tsx

This file was deleted.

6 changes: 4 additions & 2 deletions playground/src/components/Counter/Counter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@ import React, { useState } from 'react';
import { jsx } from '@emotion/core';
import tw from 'twin.macro';

import { add, subtract } from 'utils';

const Counter = (): JSX.Element => {
const [count, setCount] = useState(0);

return (
<div id="counter" tw="flex items-center justify-center w-full h-screen">
<button
type="button"
onClick={() => setCount(i => i - 1)}
onClick={() => setCount(i => subtract(i, 1))}
tw="bg-blue-500 text-white rounded py-2 px-4"
>
-
</button>
<span tw="px-4 font-bold text-2xl">{count}</span>
<button
type="button"
onClick={() => setCount(i => i + 1)}
onClick={() => setCount(i => add(i, 1))}
tw="bg-blue-500 text-white rounded py-2 px-4"
>
+
Expand Down
1 change: 0 additions & 1 deletion playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
],
"compilerOptions": {
"baseUrl": "src",
"types": [],
},
"include": [
"next-env.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"skipLibCheck": true,
"strict": true,
"target": "esnext",
"types": ["cypress"],
"types": ["jest"],
},
"exclude": ["node_modules"],
"include": [
Expand Down

0 comments on commit ef55b64

Please sign in to comment.