-
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.
Merge pull request #72 from donghquinn/dev
Dev
- Loading branch information
Showing
7 changed files
with
121 additions
and
10 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,41 @@ | ||
import { ValidatorError } from '@errors/validator.error'; | ||
import { clientLoginValidator } from '@validators/client/login.validator'; | ||
import { ClientLoginRequest } from 'types/client.type'; | ||
|
||
describe('Login Request Validator Test', () => { | ||
const request1: ClientLoginRequest = { | ||
email: '[email protected]', | ||
password: '10957239028523adscasdc', | ||
}; | ||
|
||
test('Login Validator for first Request', async () => { | ||
const { email, password } = await clientLoginValidator(request1); | ||
|
||
expect(email).toEqual('[email protected]'); | ||
expect(password).toEqual('10957239028523adscasdc'); | ||
}); | ||
|
||
test('Login Validator for Second Request; Email Format Validation', async () => { | ||
const request2: ClientLoginRequest = { | ||
email: 'example123', | ||
password: '10293745820adsc832', | ||
}; | ||
try { | ||
await clientLoginValidator(request2); | ||
} catch (error) { | ||
expect(error).toBeInstanceOf(ValidatorError); | ||
} | ||
}); | ||
|
||
test('Login Validator for Third Request; Password Length Validation', async () => { | ||
const request3: ClientLoginRequest = { | ||
email: '[email protected]', | ||
password: '132', | ||
}; | ||
try { | ||
await clientLoginValidator(request3); | ||
} catch (error) { | ||
expect(error).toBeInstanceOf(ValidatorError); | ||
} | ||
}); | ||
}); |
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,59 @@ | ||
import { ValidatorError } from '@errors/validator.error'; | ||
import { clientSignupValidator } from '@validators/client/signup.validator'; | ||
import { ClientSignupRequest } from 'types/client.type'; | ||
|
||
describe('Signup Request Validator Test', () => { | ||
const request1: ClientSignupRequest = { | ||
name: 'Daniel', | ||
email: '[email protected]', | ||
password: '10957239028523adscasdc', | ||
}; | ||
|
||
test('Signup Validator for first Request', async () => { | ||
const { email, password, name } = await clientSignupValidator(request1); | ||
|
||
expect(email).toEqual('[email protected]'); | ||
expect(password).toEqual('10957239028523adscasdc'); | ||
expect(name).toEqual('Daniel'); | ||
}); | ||
|
||
test('Signup Validator for Second Request; Email Format Validation', async () => { | ||
const request2: ClientSignupRequest = { | ||
name: 'Daniel', | ||
email: 'example123', | ||
password: '10293745820adsc832', | ||
}; | ||
try { | ||
await clientSignupValidator(request2); | ||
} catch (error) { | ||
expect(error).toBeInstanceOf(ValidatorError); | ||
} | ||
}); | ||
|
||
test('Signup Validator for Third Request; Password Length Validation', async () => { | ||
const request3: ClientSignupRequest = { | ||
name: 'Daniel', | ||
email: '[email protected]', | ||
password: '132', | ||
}; | ||
try { | ||
await clientSignupValidator(request3); | ||
} catch (error) { | ||
expect(error).toBeInstanceOf(ValidatorError); | ||
} | ||
}); | ||
|
||
test('Signup Validator for Forth Request; Name Length Validation', async () => { | ||
const request3: ClientSignupRequest = { | ||
email: '[email protected]', | ||
password: '132', | ||
name: '', | ||
}; | ||
|
||
try { | ||
await clientSignupValidator(request3); | ||
} catch (error) { | ||
expect(error).toBeInstanceOf(ValidatorError); | ||
} | ||
}); | ||
}); |