-
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
Showing
9 changed files
with
92 additions
and
76 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,43 @@ | ||
import { NameIDFilter } from './nameid.filter'; | ||
|
||
describe('NameID Format filter form', () => { | ||
describe('getValidators', () => { | ||
it('should return an empty object for validators', () => { | ||
expect(Object.keys(NameIDFilter.getValidators())).toEqual([ | ||
'/', | ||
'/name' | ||
]); | ||
}); | ||
|
||
describe('name `/name` validator', () => { | ||
const validators = NameIDFilter.getValidators(['foo', 'bar']); | ||
|
||
it('should return an invalid object when provided values are invalid based on name', () => { | ||
expect(validators['/name']('foo', { path: '/name' })).toBeDefined(); | ||
}); | ||
|
||
it('should return null when provided values are valid based on name', () => { | ||
expect(validators['/name']('baz', { path: '/name' })).toBeNull(); | ||
}); | ||
}); | ||
|
||
describe('parent `/` validator', () => { | ||
const validators = NameIDFilter.getValidators(['foo', 'bar']); | ||
|
||
it('should return a list of child errors', () => { | ||
expect(validators['/']({ name: 'foo' }, { path: '/name' }, {}).length).toBe(1); | ||
}); | ||
|
||
it('should ignore properties that don\'t exist a list of child errors', () => { | ||
expect(validators['/']({ foo: 'bar' }, { path: '/foo' }, {})).toBeUndefined(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('transformer', () => { | ||
it('should add modify the object', () => { | ||
expect(NameIDFilter.formatter({})).toEqual({}); | ||
expect(NameIDFilter.parser({})).toEqual({}); | ||
}); | ||
}); | ||
}); |
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