Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkingshott committed Apr 27, 2020
1 parent cdc347d commit 549e47b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ jobs:
env:
CI: true

- name: Install prettier
run: yarn global add prettier

- name: Run prettier
run: yarn run prettier --write 'src/**/*.js' 'tests/**/*.js'

Expand Down
10 changes: 8 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@babel/preset-env": "^7.9.0",
"babel-jest": "^25.2.4",
"jest": "^25.2.4",
"microbundle": "^0.11.0"
"microbundle": "^0.11.0",
"prettier": "^2.0.5"
}
}
}
8 changes: 4 additions & 4 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,15 @@ test('it validates values against multiple rules', () => {
*
**/
test('it retrieves formatted error messages for rules', () => {
let time = Date.UTC(2020, 4, 2, 3, 17, 0);
let time = Date.UTC(2020, 4, 2, 10, 17, 0);
Iodine.setLocale('en-US');
let hour = new Date().getTimezoneOffset() === -60 ? 4 : 3;
let hour = new Date().getTimezoneOffset() === -60 ? 11 : 10;
expect(Iodine.getErrorMessage('array')).toBe('Value must be an array');
expect(Iodine.getErrorMessage('endingWith')).toBe(`Value must end with '[PARAM]'`);
expect(Iodine.getErrorMessage('endingWith:world')).toBe(`Value must end with 'world'`);
expect(Iodine.getErrorMessage('endingWith', 'world')).toBe(`Value must end with 'world'`);
expect(Iodine.getErrorMessage(`after:${time}`)).toBe(`The date must be after: 'May 2, 2020, 0${hour}:17 AM'`);
expect(Iodine.getErrorMessage(`after`, time)).toBe(`The date must be after: 'May 2, 2020, 0${hour}:17 AM'`);
expect(Iodine.getErrorMessage(`after:${time}`)).toBe(`The date must be after: 'May 2, 2020, ${hour}:17 AM'`);
expect(Iodine.getErrorMessage(`after`, time)).toBe(`The date must be after: 'May 2, 2020, ${hour}:17 AM'`);
});


Expand Down

0 comments on commit 549e47b

Please sign in to comment.