Skip to content

Commit c56d252

Browse files
authored
Add Drawing and its test (#20)
* Move class `Drawing` from the main file and add tests * Add Prettier and configs to enforce the code format being consistent with the existing one * Remove redundant logic from Drawing class and simplify its tests * Fix format issues * Fix format issues * Update test case and reformat files
1 parent 3dd59d2 commit c56d252

File tree

11 files changed

+4617
-532
lines changed

11 files changed

+4617
-532
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.terraform*
22
*.tfstate*
3-
tfplan
3+
tfplan
4+
/.idea/

backend/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ lib-cov
2727
coverage
2828
*.lcov
2929

30-
# nyc test coverage
30+
# nyc __test__ coverage
3131
.nyc_output
3232

3333
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)

backend/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist
2+
build
3+
coverage

backend/.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": true,
3+
"useTabs": false,
4+
"tabWidth": 2,
5+
"semi": false
6+
}

backend/jest.config.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* Check https://github.com/LivingLimes/draw-freely/pull/18#issuecomment-2731114582 for a brief explanation on the configurations set below
3+
*
4+
* For a detailed explanation regarding each configuration property, visit:
5+
* https://jestjs.io/docs/configuration
6+
*/
7+
8+
import type { Config } from 'jest';
9+
10+
const config: Config = {
11+
// Coverage
12+
collectCoverage: true,
13+
coverageDirectory: './__test__/coverage',
14+
coveragePathIgnorePatterns: ['/node_modules/'],
15+
coverageProvider: 'v8',
16+
coverageReporters: ['json', 'text', 'lcov', 'clover', 'text-summary'],
17+
// Jest will fail if there is less than 80% branch, line, and function coverage, or if there are more than 10 uncovered statements:
18+
coverageThreshold: {
19+
global: {
20+
branches: 80,
21+
functions: 80,
22+
lines: 80,
23+
statements: -10,
24+
},
25+
},
26+
27+
// Test Environment
28+
testEnvironment: 'jest-environment-node',
29+
testEnvironmentOptions: {},
30+
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'],
31+
testPathIgnorePatterns: ['/node_modules/'],
32+
33+
// Miscellaneous
34+
moduleFileExtensions: [
35+
'ts',
36+
'tsx',
37+
'js',
38+
'jsx',
39+
'mjs',
40+
'cjs',
41+
'json',
42+
'node',
43+
],
44+
// The root directory that Jest should scan for tests and modules within
45+
rootDir: 'src',
46+
transform: {
47+
'\\.[jt]sx?$': 'ts-jest',
48+
},
49+
verbose: true,
50+
watchman: true,
51+
};
52+
53+
export default config;

0 commit comments

Comments
 (0)