-
Notifications
You must be signed in to change notification settings - Fork 143
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
Showing
6 changed files
with
860 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
import download from 'bemuse/download' | ||
|
||
describe('download', function() { | ||
|
||
it('resolves with correct type', function() { | ||
return expect(download('/spec/download/fixtures/hello.txt').as('text')) | ||
.to.eventually.match(/hello world/) | ||
}) | ||
|
||
it('rejects for 404', function() { | ||
return expect(download('/nonexistant').as('blob')).to.be.rejected | ||
}) | ||
|
||
it('rejects for bad url', function() { | ||
return expect(download('file:///nonexistant').as('blob')).to.be.rejected | ||
}) | ||
|
||
}) |
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 @@ | ||
hello world |
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,51 @@ | ||
|
||
import Progress from 'bemuse/progress' | ||
import * as ProgressUtils from 'bemuse/progress/utils' | ||
|
||
describe('ProgressUtils', function() { | ||
|
||
describe('.fixed', function() { | ||
it('should report for fixed number of items', function() { | ||
let progress = new Progress() | ||
let advance = ProgressUtils.fixed(10, progress) | ||
expect(progress.current).to.equal(0) | ||
expect(progress.total).to.equal(10) | ||
advance('wow') | ||
expect(progress.current).to.equal(1) | ||
expect(progress.total).to.equal(10) | ||
expect(progress.extra).to.equal('wow') | ||
}) | ||
}) | ||
|
||
describe('.wrapPromise', function() { | ||
it('should report number of fulfilled promises', function() { | ||
let progress = new Progress() | ||
let f = ProgressUtils.wrapPromise(progress, promise => promise) | ||
let a = f(new Promise(() => {})) | ||
let b = f(Promise.resolve(1)) | ||
let c = f(Promise.reject(new Error('no'))) | ||
let d = f(Promise.resolve(3)) | ||
void a | ||
void c | ||
return Promise.all([b, d]).then(() => { | ||
expect(progress.current).to.equal(2) | ||
expect(progress.total).to.equal(4) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('.bind', function() { | ||
it('should bind from one progress to another', function() { | ||
let a = new Progress() | ||
let b = new Progress() | ||
a.report(10, 20) | ||
ProgressUtils.bind(a, b) | ||
expect(b.current).to.equal(10) | ||
expect(b.total).to.equal(20) | ||
a.report(15, 25) | ||
expect(b.current).to.equal(15) | ||
expect(b.total).to.equal(25) | ||
}) | ||
}) | ||
|
||
}) |
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 @@ | ||
{"files":[{"name":"do.mp3","ref":[0,0,30093]},{"name":"mi.mp3","ref":[0,30093,60186]},{"name":"sol.mp3","ref":[0,60186,90279]}],"refs":[{"path":"mp3.0.ea6087c3.bemuse","hash":"ea6087c3379bce007e50c3100b99b83c"}]} |
Oops, something went wrong.