Skip to content

Commit c84a439

Browse files
authored
Merge pull request #40 from CodelyTV/tdd-front
TDD front
2 parents 42130c0 + eb26d34 commit c84a439

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+13105
-0
lines changed

exercises/user_signup/README.md

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
node: true,
6+
},
7+
settings: {
8+
react: {
9+
version: "detect",
10+
},
11+
},
12+
extends: ["plugin:react/recommended", "plugin:import/typescript", "plugin:@next/next/recommended"],
13+
parser: "@typescript-eslint/parser",
14+
plugins: ["react", "@typescript-eslint"],
15+
parserOptions: {
16+
ecmaFeatures: {
17+
jsx: true,
18+
},
19+
ecmaVersion: 12,
20+
sourceType: "module",
21+
},
22+
rules: {
23+
"react/react-in-jsx-scope": "off",
24+
}
25+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.next
2+
node_modules
3+
tests/pages/screenshots
4+
test-results.xml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
presets: ["next/babel"],
3+
plugins: ["babel-plugin-transform-typescript-metadata", ["@babel/plugin-proposal-decorators", { legacy: true }]],
4+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"baseUrl": "http://localhost:3000",
3+
"video": false,
4+
"reporter": "junit",
5+
"viewportWidth": 1920,
6+
"viewportHeight": 1080,
7+
"chromeWebSecurity": false,
8+
"fixturesFolder": "tests/pages/fixtures",
9+
"integrationFolder": "tests/pages",
10+
"pluginsFile": "tests/pages/plugins/index.js",
11+
"screenshotsFolder": "tests/pages/screenshots",
12+
"videosFolder": "tests/pages/videos",
13+
"downloadsFolder": "tests/pages/downloads",
14+
"supportFile": "tests/pages/support/index.ts",
15+
"testFiles": "**/*.spec.ts"
16+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
testMatch: ["<rootDir>/tests/unit/**/*.(spec|test).(js|jsx|ts|tsx)"],
3+
testEnvironment: "jsdom",
4+
setupFilesAfterEnv: ["<rootDir>/setupTests.ts"],
5+
testPathIgnorePatterns: ["node_modules", "<rootDir>/.next/"],
6+
transform: {
7+
"^.+\\.(js|jsx|ts|tsx)$": "ts-jest",
8+
},
9+
moduleNameMapper: {
10+
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
11+
"\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "jest-transform-stub",
12+
},
13+
globals: {
14+
"ts-jest": {
15+
babelConfig: true,
16+
tsconfig: {
17+
jsx: "react-jsx",
18+
},
19+
},
20+
},
21+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "user-signup",
3+
"version": "1.0.0",
4+
"private": true,
5+
"scripts": {
6+
"build": "next build",
7+
"dev": "NODE_OPTIONS='--inspect' next dev",
8+
"start": "next start",
9+
"test": "jest",
10+
"test:e2e": "yarn build && start-server-and-test 'yarn start' tcp:3000 'yarn test:e2e:run'",
11+
"test:e2e:open": "cypress open",
12+
"test:e2e:run": "cypress run"
13+
},
14+
"dependencies": {
15+
"glob": "^7.1.7",
16+
"next": "12.1.0",
17+
"next-transpile-modules": "^9.0.0",
18+
"react": "^17.0.2",
19+
"react-dom": "^17.0.2"
20+
},
21+
"devDependencies": {
22+
"@babel/core": "^7.14.3",
23+
"@babel/plugin-proposal-decorators": "^7.14.5",
24+
"@babel/preset-env": "^7.15.0",
25+
"@babel/preset-react": "^7.14.5",
26+
"@babel/preset-typescript": "^7.13.0",
27+
"@next/eslint-plugin-next": "^11.1.0",
28+
"@testing-library/cypress": "^8.0.2",
29+
"@testing-library/dom": "^7.31.0",
30+
"@testing-library/jest-dom": "^5.11.9",
31+
"@testing-library/react": "^11.2.5",
32+
"@testing-library/user-event": "^12.7.1",
33+
"@types/jest": "^27.4.1",
34+
"@types/node": "^14.17.18",
35+
"@types/react": "^17.0.19",
36+
"@types/react-dom": "^17.0.11",
37+
"@types/testing-library__jest-dom": "^5.9.5",
38+
"@typescript-eslint/eslint-plugin": "^4.31.2",
39+
"@typescript-eslint/parser": "^4.31.2",
40+
"babel-jest": "^27.5.1",
41+
"babel-plugin-transform-typescript-metadata": "^0.3.2",
42+
"cypress": "^9.2.0",
43+
"eslint": "^7.32.0",
44+
"eslint-config-next": "^11.1.0",
45+
"eslint-plugin-react": "^7.29.4",
46+
"identity-obj-proxy": "^3.0.0",
47+
"jest": "^27.5.1",
48+
"jest-transform-stub": "^2.0.0",
49+
"start-server-and-test": "^1.14.0",
50+
"ts-jest": "^27.1.4",
51+
"ts-node": "^10.2.1",
52+
"typescript": "^4.6.3"
53+
}
54+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import "@testing-library/jest-dom";
2+
3+
jest.mock("next/image", () => ({
4+
__esModule: true,
5+
default: () => {
6+
return "Next image stub";
7+
},
8+
}));
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/* https://www.joshwcomeau.com/css/custom-css-reset/ */
2+
3+
/*
4+
1. Use a more-intuitive box-sizing model.
5+
*/
6+
*,
7+
*::before,
8+
*::after {
9+
box-sizing: border-box;
10+
}
11+
12+
/*
13+
2. Remove default margin
14+
*/
15+
* {
16+
margin: 0;
17+
}
18+
19+
/*
20+
3. Allow percentage-based heights in the application
21+
*/
22+
html,
23+
body {
24+
height: 100%;
25+
}
26+
27+
/*
28+
Typographic tweaks!
29+
4. Add accessible line-height
30+
5. Improve text rendering
31+
*/
32+
body {
33+
line-height: 1.5;
34+
-webkit-font-smoothing: antialiased;
35+
}
36+
37+
/*
38+
6. Improve media defaults
39+
*/
40+
img,
41+
picture,
42+
video,
43+
canvas,
44+
svg {
45+
max-width: 100%;
46+
height: auto;
47+
}
48+
49+
video {
50+
display: block;
51+
}
52+
53+
/*
54+
7. Remove built-in form typography styles
55+
*/
56+
input,
57+
button,
58+
textarea,
59+
select {
60+
font: inherit;
61+
}
62+
63+
/*
64+
8. Avoid text overflows
65+
*/
66+
p,
67+
h1,
68+
h2,
69+
h3,
70+
h4,
71+
h5,
72+
h6 {
73+
overflow-wrap: break-word;
74+
}
75+
76+
/*
77+
9. Create a root stacking context
78+
*/
79+
#root,
80+
#__next {
81+
isolation: isolate;
82+
}
83+
84+
body {
85+
font-family: sans-serif;
86+
}

0 commit comments

Comments
 (0)