-
Notifications
You must be signed in to change notification settings - Fork 5
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 #39 from Jyrno42/aborting
Implement abortable requests
- Loading branch information
Showing
25 changed files
with
695 additions
and
87 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { AbortError } from '../src'; | ||
|
||
|
||
let instance: AbortError; | ||
const errObject = { | ||
text: 'im an error, for real!', | ||
}; | ||
|
||
beforeEach(() => { | ||
instance = new AbortError(errObject); | ||
}); | ||
|
||
|
||
describe('AbortError api', () => { | ||
test('instance.error is correct', () => { | ||
expect(instance.error).toEqual(errObject); | ||
}); | ||
|
||
test('instance.name is correct', () => { | ||
expect(instance.name).toEqual('AbortError'); | ||
}); | ||
|
||
test('instance.type is correct', () => { | ||
expect(instance.type).toEqual('aborted'); | ||
expect(new AbortError(null).type).toEqual('aborted'); | ||
}); | ||
|
||
test('instance.type is inherited from error', () => { | ||
expect(new AbortError({ | ||
type: 'foo', | ||
}).type).toEqual('foo'); | ||
}); | ||
|
||
test('toString works', () => { | ||
expect(instance.toString()).toEqual('AbortError: The user aborted a request.'); | ||
}); | ||
|
||
test('isValidationError is false', () => { | ||
expect(instance.isValidationError).toEqual(false); | ||
}); | ||
|
||
test('isInvalidResponseCode is false', () => { | ||
expect(instance.isInvalidResponseCode).toEqual(false); | ||
}); | ||
|
||
test('isNetworkError is false', () => { | ||
expect(instance.isNetworkError).toEqual(false); | ||
}); | ||
|
||
test('isAbortError is true', () => { | ||
expect(instance.isAbortError).toEqual(true); | ||
}); | ||
}); |
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
Oops, something went wrong.