-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95dc4c4
commit 84637bc
Showing
3 changed files
with
46 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import Remote from '../src/lib/remote'; | ||
import mock from 'xhr-mock'; | ||
|
||
describe('Basic Remote Functionality', () => { | ||
const fakeUrl = 'http://not-real.com/vast.xml'; | ||
|
||
beforeEach(() => { | ||
mock.setup(); | ||
mock.get(fakeUrl, { body: 'nope' }); | ||
}); | ||
afterEach(() => { | ||
mock.teardown(); | ||
}); | ||
|
||
it('should have a single static function', () => { | ||
expect(Remote.loadUrl).toBeDefined(); | ||
expect(typeof Remote.loadUrl).toBe('function'); | ||
}); | ||
|
||
it('should be able to be used without a bandwith function', async () => { | ||
await Remote.loadUrl({ | ||
url: fakeUrl, | ||
}); | ||
}); | ||
|
||
it('should callback the bandwidth function after load', async () => { | ||
const bandwidthTest = jest.fn(); | ||
await Remote.loadUrl({ | ||
url: fakeUrl, | ||
onBandwidthUpdate: bandwidthTest, | ||
}); | ||
expect(bandwidthTest).toHaveBeenCalled(); | ||
}); | ||
}); |