-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(thru): Make thru parametric in its return type (#473)
- Loading branch information
1 parent
d3889d3
commit b9dc0e2
Showing
4 changed files
with
33 additions
and
16 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 |
---|---|---|
@@ -1,30 +1,28 @@ | ||
/* global describe, it */ | ||
require('buster').spec.expose() | ||
var expect = require('buster').expect | ||
import { spec, referee } from 'buster' | ||
const { describe, it } = spec | ||
const { assert } = referee | ||
|
||
var thru = require('../../src/combinator/thru').thru | ||
import { thru } from '../../src/combinator/thru' | ||
|
||
describe('thru', function () { | ||
it('should apply f to stream', function () { | ||
var stream = {} | ||
var expected = {} | ||
function f (s) { | ||
return expected | ||
} | ||
const stream = {} | ||
const expected = {} | ||
const f = s => expected | ||
|
||
expect(thru(f, stream)).toBe(expected) | ||
assert.same(expected, thru(f, stream)) | ||
}) | ||
|
||
it('should throw synchronously if f throws synchronously', function () { | ||
var error = new Error() | ||
const error = new Error() | ||
function f () { | ||
throw error | ||
} | ||
|
||
try { | ||
thru(f, {}) | ||
} catch (e) { | ||
expect(e).toBe(error) | ||
assert.same(error, e) | ||
} | ||
}) | ||
}) |
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