-
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.
* test: should be able to able to change a value informational message * test: should be able to able to throw error if value is different from string and undefined * test: should be able to able to throw error if value does not have the reserved keys * test: should be able to able to not change the informational message * refactor: setTranslationMessage * chore: add summary of changesets
- Loading branch information
Showing
6 changed files
with
463 additions
and
272 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,5 @@ | ||
--- | ||
"vkrun": minor | ||
--- | ||
|
||
refactor setTranslationMessage function and create tests to achieve 100% test coverage |
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,82 @@ | ||
import { InformativeMessage } from '../types' | ||
import { informativeMessage } from './informative-message' | ||
|
||
export const resetTranslationMessage = (): void => { | ||
const newInformativeMessage: InformativeMessage = { | ||
validator: { | ||
constructorParams: { | ||
valueName: { | ||
missingClassParam: 'missing class param: valueName is required!', | ||
invalidClassParam: 'invalid class param: errorType provided is not valid!' | ||
} | ||
}, | ||
method: { | ||
string: { | ||
strict: '[valueName] must be a string type!' | ||
}, | ||
minWord: { | ||
noMinimumWords: '[valueName] must have at least [minWord] words!' | ||
}, | ||
uuid: { | ||
strict: '[valueName] must be a uuid type!' | ||
}, | ||
email: { | ||
strict: 'email [value] is invalid!' | ||
}, | ||
maxLength: { | ||
strict: '[valueName] must have a maximum of [maxLength] characters!' | ||
}, | ||
minLength: { | ||
strict: '[valueName] must have a minimum of [minLength] characters!' | ||
}, | ||
number: { | ||
strict: '[valueName] must be a number type!' | ||
}, | ||
float: { | ||
strict: '[valueName] must be a number and float!' | ||
}, | ||
integer: { | ||
strict: '[valueName] must be a number and integer!' | ||
}, | ||
boolean: { | ||
strict: '[valueName] must be a boolean type!' | ||
}, | ||
required: { | ||
strict: '[valueName] is required!' | ||
}, | ||
date: { | ||
invalidFormat: 'the date [valueName] is not in the format [type]!', | ||
invalidParameter: 'date method received invalid parameter: type is required!' | ||
}, | ||
dateGreaterThan: { | ||
invalidDate: 'the provided date is invalid!', | ||
limitExceeded: 'the date [valueName] must be greater than the reference date!' | ||
}, | ||
dateLessThan: { | ||
invalidDate: 'the provided date is invalid!', | ||
limitExceeded: 'the date [valueName] must be less than the reference date!' | ||
}, | ||
time: { | ||
invalidParameter: 'time method received invalid parameter: type is required!', | ||
invalidFormat: 'the time [value] is not in the format [type]' | ||
} | ||
} | ||
}, | ||
schema: { | ||
validateProperty: { | ||
itemArray: { | ||
valueName: 'all values in the [keyName]' | ||
} | ||
}, | ||
validateSchema: { | ||
keyNotDeclaredInTheSchema: '[keyName] key was not declared in the schema' | ||
}, | ||
validateObject: { | ||
schemaKeyAbsent: '[keyName] key is required!', | ||
notIsArray: '[keyName] value must be an array!' | ||
} | ||
} | ||
} | ||
|
||
Object.assign(informativeMessage, newInformativeMessage) | ||
} |
Oops, something went wrong.