-
Notifications
You must be signed in to change notification settings - Fork 2
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
* only call the xhr abort if the request has been sent * test request constructor to get at least a bit of coverage
- Loading branch information
Showing
4 changed files
with
45 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-env mocha */ | ||
|
||
const istanbulVM = require('../testable/node/istanbulVM'); | ||
const expect = require('chai').expect; | ||
|
||
|
||
describe('NetworkRequest', () => { | ||
const vm = istanbulVM(); | ||
|
||
istanbulVM.applyNodeEnv(vm); | ||
|
||
vm.runModule('../testable/core/NetworkRequest'); | ||
|
||
it('should construct a new request', () => { | ||
const result = vm.runModule('./testTasks/NetworkRequest/construct'); | ||
|
||
expect(result.instance.url).to.equal('https://example.org'); | ||
expect(result.instance.method).to.equal('POST'); | ||
expect(result.instance.type).to.equal('json'); | ||
}); | ||
}); |
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,3 @@ | ||
/* global NetworkRequest */ | ||
global.NetworkRequest = NetworkRequest; | ||
global.instance = Object.create(NetworkRequest).constructor('https://example.org', { method: 'POST', type: 'json' }); |