-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
67 changed files
with
5,244 additions
and
4,922 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,23 @@ | ||
'use strict'; | ||
var eq = require('./shared/utils').eq; | ||
var R = require('ramda'); | ||
var S = require('..'); | ||
|
||
describe('A', function() { | ||
|
||
it('is a binary function', function() { | ||
eq(typeof S.A, 'function'); | ||
eq(S.A.length, 2); | ||
}); | ||
|
||
it('A(f, x) is equivalent to f(x)', function() { | ||
eq(S.A(S.inc, 1), 2); | ||
eq(R.map(S.A(R.__, 100), [S.inc, Math.sqrt]), [101, 10]); | ||
}); | ||
|
||
it('is curried', function() { | ||
eq(S.A(S.inc).length, 1); | ||
eq(S.A(S.inc)(1), 2); | ||
}); | ||
|
||
}); |
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,10 @@ | ||
'use strict'; | ||
var runCompositionTests = require('./shared/utils').runCompositionTests; | ||
var S = require('..'); | ||
|
||
describe('B', function() { | ||
|
||
runCompositionTests(S.B); | ||
|
||
}); | ||
|
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,24 @@ | ||
'use strict'; | ||
var eq = require('./shared/utils').eq; | ||
var R = require('ramda'); | ||
var S = require('..'); | ||
|
||
describe('C', function() { | ||
|
||
it('is a ternary function', function() { | ||
eq(typeof S.C, 'function'); | ||
eq(S.C.length, 3); | ||
}); | ||
|
||
it('C(f, x, y) is equivalent to f(y)(x)', function() { | ||
eq(S.C(S.concat, 'foo', 'bar'), 'barfoo'); | ||
eq(R.map(S.C(S.concat, '!'), ['BAM', 'POW', 'KA-POW']), ['BAM!', 'POW!', 'KA-POW!']); | ||
}); | ||
|
||
it('is curried', function() { | ||
eq(S.C(S.concat).length, 2); | ||
eq(S.C(S.concat)('foo').length, 1); | ||
eq(S.C(S.concat)('foo')('bar'), 'barfoo'); | ||
}); | ||
|
||
}); |
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,13 @@ | ||
'use strict'; | ||
var errorEq = require('./shared/utils').errorEq; | ||
var S = require('..'); | ||
var throws = require('assert').throws; | ||
|
||
describe('Either', function() { | ||
|
||
it('throws if called', function() { | ||
throws(function() { S.Either(); }, | ||
errorEq(Error, 'Cannot instantiate Either')); | ||
}); | ||
|
||
}); |
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,14 @@ | ||
'use strict'; | ||
var $ = require('sanctuary-def'); | ||
var eq = require('./shared/utils').eq; | ||
var S = require('..'); | ||
|
||
describe('EitherType', function() { | ||
|
||
it('has its type definition exported', function() { | ||
eq(S.EitherType($.String, $.Number).test(S.Left('Error')), true); | ||
eq(S.EitherType($.String, $.Number).test(S.Right(1)), true); | ||
eq(S.EitherType($.String, $.Number).test(1), false); | ||
}); | ||
|
||
}); |
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,18 @@ | ||
'use strict'; | ||
var eq = require('./shared/utils').eq; | ||
var S = require('..'); | ||
|
||
describe('I', function() { | ||
|
||
it('is a unary function', function() { | ||
eq(typeof S.I, 'function'); | ||
eq(S.I.length, 1); | ||
}); | ||
|
||
it('returns its argument', function() { | ||
eq(S.I([1, 2, 3]), [1, 2, 3]); | ||
eq(S.I({'@@type': 'my-package/Foreign'}), | ||
{'@@type': 'my-package/Foreign'}); | ||
}); | ||
|
||
}); |
Oops, something went wrong.