Skip to content

Commit

Permalink
test: added more tests for request signal (#73)
Browse files Browse the repository at this point in the history
Co-authored-by: Jacob Ebey <[email protected]>
Co-authored-by: Irakli Gozalishvili <[email protected]>
  • Loading branch information
3 people authored Aug 28, 2023
1 parent dff75d9 commit c74db27
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/fetch/test/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,26 @@ describe('Request', () => {
expect(derivedRequest.signal).to.not.equal(parentAbortController.signal);
});


it('should abort signal', () => {
const controller = new AbortController();
const request = new Request(base, {
signal: controller.signal,
});
controller.abort();
expect(request.signal.aborted).to.equal(true);
});

it('should abort signal after clone', () => {
const controller = new AbortController();
const request = new Request(base, {
signal: controller.signal,
});
controller.abort();
const clonedRequest = request.clone();
expect(clonedRequest.signal.aborted).to.equal(true);
});

it('should default to "same-origin" as credentials', () => {
const request = new Request(base)
expect(request.credentials).to.equal('same-origin');
Expand Down

0 comments on commit c74db27

Please sign in to comment.