Skip to content

Commit

Permalink
Register Applications: update validation rule name
Browse files Browse the repository at this point in the history
Resolves #770
  • Loading branch information
oodamien committed May 4, 2018
1 parent 7a58b86 commit 55a202c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('AppsRegisterComponent', () => {
it('should display an error if no the name is invalid', () => {
const tests = [
{name: '', type: 'source', uri: 'http://foo.bar', metaDataUri: '', force: false},
{name: 'foo bar', type: 'sink', uri: 'http://foo.bar', metaDataUri: '', force: false}
{name: 'd', type: 'sink', uri: 'http://foo.bar', metaDataUri: '', force: false}
];
const form = component.forms[0];
tests.forEach((test) => {
Expand Down
7 changes: 4 additions & 3 deletions ui/src/app/apps/apps-register/apps-register.validator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ describe('AppsRegisterValidator', () => {
describe('appName', () => {

it('invalid', () => {
[' ', 'f', 'fo ', 'foo>', 'foo.', 'foo/', 'foo?', 'foo{', 'foo}', 'foo^', 'foo$', 'foo#', 'foo@', 'foo*',
'foo(', 'foo)', 'foo[', 'foo]', 'foo<', 'foo>', 'foo,', 'foo!', 'foo|', 'foo bar'].forEach((mock) => {
[' ', 'f'].forEach((mock) => {
const appName: FormControl = new FormControl(mock);
const result = AppsRegisterValidator.appName(appName);
expect(result.invalid).toBeTruthy();
});
});

it('valid', () => {
[null, 'fo', 'foo', 'f12', 'foo12', 'foooooooooooooooooooooooooo'].forEach((mock) => {
[null, 'fo', 'foo', 'f12', 'foo12', 'foooooooooooooooooooooooooo', 'fo ', 'foo>', 'foo.', 'foo/', 'foo?', 'foo-',
'foo{', 'foo}', 'foo^', 'foo$', 'foo#', 'foo@', 'foo*', 'foo(', 'foo)', 'foo[', 'foo]', 'foo<', 'foo>',
'foo,', 'foo!', 'foo|', 'foo bar'].forEach((mock) => {
const appName: FormControl = new FormControl(mock);
const result = AppsRegisterValidator.appName(appName);
expect(result).toBeNull();
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/apps/apps-register/apps-register.validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class AppsRegisterValidator {
/**
* Name regex
*/
static nameRegex = /^[a-zA-Z0-9]{2,50}$/;
static nameRegex = /^.{2,250}$/;

/**
* Uri regex
Expand Down

0 comments on commit 55a202c

Please sign in to comment.