-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
07e67fd
commit 30d35b3
Showing
11 changed files
with
122 additions
and
19 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import errorMessages from '@/constants/error-messages' | ||
import { CreateAppModel } from '@reapit/foundations-ts-definitions' | ||
import { CustomCreateAppModel } from '@/components/pages/developer-submit-app' | ||
import { validate } from '../submit-app' | ||
|
||
describe('submitAppValidation', () => { | ||
it('validate require all field', () => { | ||
const input: CreateAppModel = { | ||
const input: CustomCreateAppModel = { | ||
screen4ImageUrl: '', | ||
screen3ImageUrl: '', | ||
screen2ImageUrl: '', | ||
|
@@ -18,6 +18,7 @@ describe('submitAppValidation', () => { | |
description: '', | ||
summary: '', | ||
scopes: [], | ||
redirectUris: '', | ||
} | ||
|
||
const validateRequiredKeys = [ | ||
|
@@ -30,6 +31,7 @@ describe('submitAppValidation', () => { | |
'description', | ||
'screen1ImageUrl', | ||
'summary', | ||
'redirectUris', | ||
] | ||
|
||
const output = {} | ||
|
@@ -41,7 +43,7 @@ describe('submitAppValidation', () => { | |
}) | ||
|
||
it('validate email field support email', () => { | ||
const input: CreateAppModel = { | ||
const input: CustomCreateAppModel = { | ||
screen4ImageUrl: 'test', | ||
screen3ImageUrl: 'test', | ||
screen2ImageUrl: 'test', | ||
|
@@ -55,15 +57,39 @@ describe('submitAppValidation', () => { | |
description: 'test', | ||
summary: 'test', | ||
scopes: [], | ||
redirectUris: 'https://google.com,https://twitter.com,http://localhost:8080', | ||
} | ||
|
||
expect(validate(input)).toEqual({ | ||
supportEmail: errorMessages.FIELD_WRONG_EMAIL_FORMAT, | ||
}) | ||
}) | ||
|
||
it('validate redirect uri(s) field ', () => { | ||
const input: CustomCreateAppModel = { | ||
screen4ImageUrl: 'test', | ||
screen3ImageUrl: 'test', | ||
screen2ImageUrl: 'test', | ||
screen1ImageUrl: 'test', | ||
name: 'test', | ||
telephone: 'test', | ||
supportEmail: '[email protected]', | ||
launchUri: 'test', | ||
iconImageUrl: 'test', | ||
homePage: 'test', | ||
description: 'test', | ||
summary: 'test', | ||
scopes: [], | ||
redirectUris: 'http://google.com,https://twitter.com,http://localhost:8080', | ||
} | ||
|
||
expect(validate(input)).toEqual({ | ||
redirectUris: 'Invalid redirect uri(s)', | ||
}) | ||
}) | ||
|
||
it('return empty object it everything is valid', () => { | ||
const input: CreateAppModel = { | ||
const input: CustomCreateAppModel = { | ||
screen4ImageUrl: 'test', | ||
screen3ImageUrl: 'test', | ||
screen2ImageUrl: 'test', | ||
|
@@ -77,6 +103,7 @@ describe('submitAppValidation', () => { | |
description: 'test', | ||
summary: 'test', | ||
scopes: [], | ||
redirectUris: 'https://google.com,https://twitter.com,http://localhost:8080', | ||
} | ||
|
||
expect(validate(input)).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