-
Notifications
You must be signed in to change notification settings - Fork 6
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 #195 from 4lessandrodev/fix/194/nullish-result-value
Fix/194/nullish result value
- Loading branch information
Showing
10 changed files
with
69 additions
and
33 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
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 |
---|---|---|
|
@@ -97,11 +97,7 @@ describe('fail', () => { | |
arg: string; | ||
} | ||
|
||
interface Payload { | ||
user: any; | ||
} | ||
|
||
const result = Fail<Generic, MetaData, Payload>({ message: 'invalid email' }, { arg: '[email protected]' }); | ||
const result = Fail<Generic, MetaData>({ message: 'invalid email' }, { arg: '[email protected]' }); | ||
expect(result.isOk()).toBeFalsy(); | ||
expect(result.isFail()).toBeTruthy(); | ||
expect(result.toObject()).toEqual({ | ||
|
@@ -116,7 +112,6 @@ describe('fail', () => { | |
describe('generic types', () => { | ||
|
||
type Error = { message: string }; | ||
type Payload = { data: { status: number } }; | ||
type MetaData = { args: number }; | ||
|
||
it('should fail generate the same payload as result', () => { | ||
|
@@ -125,10 +120,10 @@ describe('fail', () => { | |
const metaData: MetaData = { args: status }; | ||
const error: Error = { message: 'something went wrong!' }; | ||
|
||
const resultInstance = Result.fail<Error, MetaData, Payload>(error, metaData); | ||
const okInstance = Fail<Error, MetaData, Payload>(error, metaData); | ||
const resultInstance = Result.fail<Error, MetaData>(error, metaData); | ||
const failInstance = Fail<Error, MetaData>(error, metaData); | ||
|
||
expect(resultInstance.toObject()).toEqual(okInstance.toObject()); | ||
expect(resultInstance.toObject()).toEqual(failInstance.toObject()); | ||
|
||
}); | ||
|
||
|
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