@jikan0/test-utils 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": ["../.eslintrc.json"],
3
+ "ignorePatterns": ["!**/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
+ "rules": {}
8
+ },
9
+ {
10
+ "files": ["*.ts", "*.tsx"],
11
+ "rules": {}
12
+ },
13
+ {
14
+ "files": ["*.js", "*.jsx"],
15
+ "rules": {}
16
+ },
17
+ {
18
+ "files": ["*.json"],
19
+ "parser": "jsonc-eslint-parser",
20
+ "rules": {
21
+ "@nx/dependency-checks": "error"
22
+ }
23
+ }
24
+ ]
25
+ }
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # test-utils
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build test-utils` to build the library.
8
+
9
+ ## Running unit tests
10
+
11
+ Run `nx test test-utils` to execute the unit tests via [Jest](https://jestjs.io).
package/jest.config.ts ADDED
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ export default {
3
+ displayName: 'test-utils',
4
+ preset: '../jest.preset.js',
5
+ testEnvironment: 'node',
6
+ transform: {
7
+ '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
8
+ },
9
+ moduleFileExtensions: ['ts', 'js', 'html'],
10
+ coverageDirectory: '../coverage/test-utils',
11
+ };
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@jikan0/test-utils",
3
+ "version": "1.1.0",
4
+ "dependencies": {
5
+ "tslib": "^2.3.0"
6
+ },
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "type": "commonjs",
11
+ "main": "./src/index.js",
12
+ "typings": "./src/index.d.ts"
13
+ }
package/project.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "test-utils",
3
+ "$schema": "../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "test-utils/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "build": {
8
+ "executor": "@nx/js:tsc",
9
+ "outputs": ["{options.outputPath}"],
10
+ "options": {
11
+ "outputPath": "dist/test-utils",
12
+ "main": "test-utils/src/index.ts",
13
+ "tsConfig": "test-utils/tsconfig.lib.json",
14
+ "assets": ["test-utils/*.md"]
15
+ }
16
+ },
17
+ "lint": {
18
+ "executor": "@nx/eslint:lint",
19
+ "outputs": ["{options.outputFile}"]
20
+ },
21
+ "test": {
22
+ "executor": "@nx/jest:jest",
23
+ "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
24
+ "options": {
25
+ "jestConfig": "test-utils/jest.config.ts"
26
+ }
27
+ }
28
+ },
29
+ "tags": []
30
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './lib/testUtils';
@@ -0,0 +1,34 @@
1
+ export const BASIC_EXERCISE_PROGRAM = (() => {
2
+ const ROUND_TYPES = ['warmup', 'exercise', 'rest', 'cooldown'] as const;
3
+ type RoundType = (typeof ROUND_TYPES)[number];
4
+ const ONE_MINUTE = 60 * 1000;
5
+ const TOTAL_ROUNDS = 10;
6
+ const WARMUP_DURATION = 5 * ONE_MINUTE;
7
+ const EXERCISE_DURATION = 3 * ONE_MINUTE;
8
+ // noinspection PointlessArithmeticExpressionJS
9
+ const REST_DURATION = 1 * ONE_MINUTE;
10
+ const COOLDOWN_DURATION = 5 * ONE_MINUTE;
11
+ const DURATIONS: {
12
+ [K in RoundType]: number;
13
+ } = {
14
+ warmup: WARMUP_DURATION,
15
+ exercise: EXERCISE_DURATION,
16
+ rest: REST_DURATION,
17
+ cooldown: COOLDOWN_DURATION,
18
+ };
19
+ return [...Array(TOTAL_ROUNDS + 2 /*warmup/cooldown*/).keys()]
20
+ .map(
21
+ (i): RoundType =>
22
+ i === 0
23
+ ? 'warmup'
24
+ : i === TOTAL_ROUNDS + 1
25
+ ? 'cooldown'
26
+ : i % 2 === 1
27
+ ? 'exercise'
28
+ : 'rest'
29
+ )
30
+ .map((kind) => ({
31
+ kind,
32
+ duration: DURATIONS[kind],
33
+ }));
34
+ })();
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": "../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "forceConsistentCasingInFileNames": true,
6
+ "strict": true,
7
+ "noImplicitOverride": true,
8
+ "noPropertyAccessFromIndexSignature": true,
9
+ "noImplicitReturns": true,
10
+ "noFallthroughCasesInSwitch": true
11
+ },
12
+ "files": [],
13
+ "include": [],
14
+ "references": [
15
+ {
16
+ "path": "./tsconfig.lib.json"
17
+ },
18
+ {
19
+ "path": "./tsconfig.spec.json"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../dist/out-tsc",
5
+ "declaration": true,
6
+ "types": ["node"]
7
+ },
8
+ "include": ["src/**/*.ts"],
9
+ "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
10
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": ["jest", "node"]
7
+ },
8
+ "include": [
9
+ "jest.config.ts",
10
+ "src/**/*.test.ts",
11
+ "src/**/*.spec.ts",
12
+ "src/**/*.d.ts"
13
+ ]
14
+ }