-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #395 from Enterprise-CMCS/master
Release to val
- Loading branch information
Showing
20 changed files
with
226 additions
and
412 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2016", | ||
"moduleResolution": "node", | ||
"module": "commonjs", | ||
"skipLibCheck": true, | ||
"esModuleInterop": true, | ||
"resolveJsonModule": true | ||
}, | ||
"include": ["./**/*.ts"], | ||
"exclude": ["node_modules"] | ||
} |
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 was deleted.
Oops, something went wrong.
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,42 @@ | ||
import { it, describe, expect } from "vitest"; | ||
import { convertRegexToString, reInsertRegex } from "../regex"; | ||
|
||
const testRegex = /^-?\d*\.?\d+$/g; | ||
|
||
const testForm = { | ||
label: "SSI federal benefit amount", | ||
value: "ssi_federal_benefit_amount", | ||
slots: [ | ||
{ | ||
rhf: "Input", | ||
name: "ssi_federal_benefit_percentage", | ||
label: "Enter the SSI Federal Benefit Rate percentage", | ||
props: { | ||
icon: "%", | ||
}, | ||
rules: { | ||
pattern: { | ||
value: testRegex, | ||
message: "Must be a percentage", | ||
}, | ||
required: "* Required", | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
describe("form regex", () => { | ||
it("conversion logic should work", () => { | ||
const result = convertRegexToString(testForm); | ||
const val = result.slots[0].rules.pattern.value; | ||
|
||
const jsonVal = JSON.stringify(val); | ||
expect(jsonVal).toBeTypeOf("string"); | ||
|
||
const parsedVal = JSON.parse(jsonVal); | ||
|
||
const restoredRegex = new RegExp(parsedVal[1], parsedVal[2]); | ||
expect(restoredRegex).toEqual(testRegex); | ||
expect(reInsertRegex(result)).toEqual(testForm); | ||
}); | ||
}); |
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
Oops, something went wrong.