-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix emails validator and add unit tests * Fix admin members roles adding / removal * Fix tests, remove admin email from profile
- Loading branch information
1 parent
92e6e2e
commit ccbad94
Showing
11 changed files
with
50 additions
and
49 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
22 changes: 22 additions & 0 deletions
22
s4e-web/src/app/views/settings/email-list-validator.spec.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,22 @@ | ||
import {emailListValidator} from './email-list-validator.utils'; | ||
import {FormControl} from '@angular/forms'; | ||
|
||
describe('emailListValidator', () => { | ||
function validateValue(value: string) { | ||
const control = new FormControl(value); | ||
return emailListValidator(control) | ||
} | ||
|
||
it('should work', () => { | ||
expect(validateValue('notValid')).toEqual({emails: true}); | ||
expect(validateValue('admin; admin2 ? admin@mail.pl')).toEqual({emails: true}); | ||
expect(validateValue('admin, admin@mail.pl')).toEqual({emails: true}); | ||
expect(validateValue('admin@mail.pl')).toEqual(null); | ||
expect(validateValue('admin@mail.pl, admin2@mail.pl')).toEqual(null); | ||
expect(validateValue('admin@mail.pl,admin2@mail.pl')).toEqual(null); | ||
expect(validateValue('admin@mail.pl, admin2@mail.pl')).toEqual(null); | ||
expect(validateValue(' admin@mail.pl, admin2@mail.pl ')).toEqual(null); | ||
expect(validateValue('')).toEqual(null); | ||
expect(validateValue(null)).toEqual(null); | ||
}); | ||
}); |
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
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