-
Notifications
You must be signed in to change notification settings - Fork 8
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
b935861
commit 3ce8c9d
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
packages/datasource-toolkit/test/validation/field/field.test.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,14 @@ | ||
import FieldValidator from '../../../src/validation/field'; | ||
|
||
describe('FieldValidator', () => { | ||
test('should fail with name conataining space', () => { | ||
expect(() => FieldValidator.validateName('collectionName', 'field name')).toThrow( | ||
`The name of field 'field name' you configured on 'collectionName' must not contain space.` + | ||
` Something like 'fieldName' should work has expected.`, | ||
); | ||
}); | ||
|
||
test('should not fail with a valid name', () => { | ||
expect(() => FieldValidator.validateName('collectionName', 'fieldName')).not.toThrow(); | ||
}); | ||
}); |