-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a94f94a
commit c12202b
Showing
23 changed files
with
225 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"jsc": { | ||
"target": "es2022", | ||
"parser": { | ||
"syntax": "typescript", | ||
"decorators": true, | ||
"dynamicImport": true | ||
}, | ||
"transform": { | ||
"decoratorMetadata": true, | ||
"legacyDecorator": true | ||
}, | ||
"keepClassNames": true, | ||
"externalHelpers": true, | ||
"loose": true | ||
}, | ||
"module": { | ||
"type": "es6" | ||
}, | ||
"sourceMaps": true, | ||
"exclude": [".*\\.spec.tsx?$", ".*\\.step.ts$", ".*\\.test.tsx?$", ".*.js$"] | ||
} |
17 changes: 17 additions & 0 deletions
17
libs/pathway-design/common/business/pathway/rules/biome.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "../../../../../../node_modules/@biomejs/biome/configuration_schema.json", | ||
"extends": ["../../../../../../biome.json"], | ||
"linter": { | ||
"rules": { | ||
"nursery": { | ||
"noRestrictedImports": { | ||
"options": { | ||
"paths": {} | ||
}, | ||
"level": "error" | ||
} | ||
} | ||
} | ||
}, | ||
"overrides": [{}] | ||
} |
11 changes: 11 additions & 0 deletions
11
libs/pathway-design/common/business/pathway/rules/cucumber.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
default: { | ||
paths: ['libs/pathway-design/common/business/pathway/rules/src/lib/**/*.feature'], | ||
requireModule: ['ts-node/register', 'tsconfig-paths/register'], | ||
require: ['libs/pathway-design/common/business/pathway/rules/src/lib/**/*.step.ts'], | ||
format: [ | ||
'json:dist/reports/libs/pathway-design/common/business/pathway/rules/test-feature/index.json', | ||
'html:dist/reports/libs/pathway-design/common/business/pathway/rules/test-feature/index.html', | ||
], | ||
}, | ||
}; |
9 changes: 9 additions & 0 deletions
9
libs/pathway-design/common/business/pathway/rules/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "@bewoak/pathway-design-common-business-pathway-rules", | ||
"version": "0.0.1", | ||
"dependencies": { | ||
"@swc/helpers": "~0.5.11" | ||
}, | ||
"main": "./src/index.js", | ||
"typings": "./src/index.d.ts" | ||
} |
50 changes: 50 additions & 0 deletions
50
libs/pathway-design/common/business/pathway/rules/project.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "pathway-design-common-business-pathway-rules", | ||
"$schema": "../../../../../../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "libs/pathway-design/common-business/pathway/rules/src", | ||
"projectType": "library", | ||
"targets": { | ||
"build": { | ||
"executor": "@nx/js:swc", | ||
"outputs": ["{options.outputPath}"], | ||
"options": { | ||
"outputPath": "dist/libs/pathway-design/common-business/pathway/rules", | ||
"main": "libs/pathway-design/common-business/pathway/rules/src/index.ts", | ||
"tsConfig": "libs/pathway-design/common-business/pathway/rules/tsconfig.lib.json", | ||
"assets": [] | ||
} | ||
}, | ||
"nx-release-publish": { | ||
"options": { | ||
"packageRoot": "dist/{projectRoot}" | ||
} | ||
}, | ||
"lint": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "bun run biome check --write {projectRoot} --config-path={projectRoot}/biome.json" | ||
} | ||
}, | ||
"test": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "bun test --coverage --coverage-dir=dist/reports/{projectRoot}/coverage --coverage-reporter=lcov {projectRoot}" | ||
} | ||
}, | ||
"test-feature": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"command": "TS_NODE_PROJECT='{projectRoot}/tsconfig.spec.json' bun run cucumber-js --config={projectRoot}/cucumber.js" | ||
} | ||
} | ||
}, | ||
"tags": ["type:pathway-design:common:business:pathway:rules"], | ||
"release": { | ||
"version": { | ||
"generatorOptions": { | ||
"packageRoot": "dist/{projectRoot}", | ||
"currentVersionResolver": "git-tag" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { PDCBPR_titleRules } from './lib/title/title.rules'; |
12 changes: 12 additions & 0 deletions
12
libs/pathway-design/common/business/pathway/rules/src/lib/title/title.rules.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { Rules } from '../types'; | ||
|
||
export const PDCBPR_titleRules: Rules = { | ||
textError: function () { | ||
return `Renseigner un nom entre 1 et ${this.maxLength} caractères.`; | ||
}, | ||
isValid: function (value: string | null) { | ||
return value !== null && value.trim().length !== 0 && value.trim().length <= this.maxLength; | ||
}, | ||
isRequired: true, | ||
maxLength: 100, | ||
}; |
38 changes: 38 additions & 0 deletions
38
libs/pathway-design/common/business/pathway/rules/src/lib/title/title.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { describe, expect, test } from 'bun:test'; | ||
import { PDCBPR_titleRules } from './title.rules'; | ||
|
||
describe('PDCBPR_titleRules', () => { | ||
test('should return true for a valid title', () => { | ||
const validTitle = 'A valid title'; | ||
expect(PDCBPR_titleRules.isValid(validTitle)).toBe(true); | ||
}); | ||
|
||
test('should return false for a null value', () => { | ||
expect(PDCBPR_titleRules.isValid(null)).toBe(false); | ||
}); | ||
|
||
test('should return false for an empty title', () => { | ||
const emptyTitle = ''; | ||
expect(PDCBPR_titleRules.isValid(emptyTitle)).toBe(false); | ||
}); | ||
|
||
test('should return false for a title longer than the maxLength', () => { | ||
const longTitle = 'A'.repeat(PDCBPR_titleRules.maxLength + 1); | ||
expect(PDCBPR_titleRules.isValid(longTitle)).toBe(false); | ||
}); | ||
|
||
test('should return true for a title exactly at maxLength', () => { | ||
const maxLengthTitle = 'A'.repeat(PDCBPR_titleRules.maxLength); | ||
expect(PDCBPR_titleRules.isValid(maxLengthTitle)).toBe(true); | ||
}); | ||
|
||
test('should return false for a title with only spaces', () => { | ||
const spacesTitle = ' '; | ||
expect(PDCBPR_titleRules.isValid(spacesTitle)).toBe(false); | ||
}); | ||
|
||
test('should return correct error message textError', () => { | ||
const expectedErrorMessage = `Renseigner un nom entre 1 et ${PDCBPR_titleRules.maxLength} caractères.`; | ||
expect(PDCBPR_titleRules.textError()).toBe(expectedErrorMessage); | ||
}); | ||
}); |
6 changes: 6 additions & 0 deletions
6
libs/pathway-design/common/business/pathway/rules/src/lib/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface Rules { | ||
textError: () => string; | ||
isValid: (value: string | null) => boolean; | ||
readonly isRequired: boolean; | ||
readonly maxLength: number; | ||
} |
22 changes: 22 additions & 0 deletions
22
libs/pathway-design/common/business/pathway/rules/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"extends": "../../../../../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"module": "es2022", | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noImplicitOverride": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.lib.json" | ||
}, | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
libs/pathway-design/common/business/pathway/rules/tsconfig.lib.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../../../../../dist/out-tsc", | ||
"types": ["node"], | ||
"composite": true, | ||
"declaration": true | ||
}, | ||
"include": ["src/**/*.ts"], | ||
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.step.ts"] | ||
} |
10 changes: 10 additions & 0 deletions
10
libs/pathway-design/common/business/pathway/rules/tsconfig.spec.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"module": "CommonJS", | ||
"esModuleInterop": true, | ||
"composite": true, | ||
"declaration": true | ||
}, | ||
"include": ["src/**/*.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../pathway-design/server/pathway/business/src/lib/value-objects/description.value-object.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
libs/pathway-design/server/pathway/business/src/lib/value-objects/pathway-id.value-object.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...thway-design/server/pathway/business/src/lib/value-objects/research-field.value-object.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...way/interface-adapters/src/lib/initialize/initialize-pathway-interface-adapters.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters