-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate basic fantasyland laws tests
- Loading branch information
1 parent
4434b0d
commit 4746514
Showing
1 changed file
with
65 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { describe, it } from 'mocha' | ||
import { fulfill, Promise } from '../src/main' | ||
import { assertSame } from './lib/test-util' | ||
import * as Functor from 'fantasy-land/laws/functor' | ||
import * as Chain from 'fantasy-land/laws/chain' | ||
import * as Apply from 'fantasy-land/laws/apply' | ||
import * as Applicative from 'fantasy-land/laws/applicative' | ||
import * as Semigroup from 'fantasy-land/laws/semigroup' | ||
import * as Monoid from 'fantasy-land/laws/monoid' | ||
|
||
describe('fantasyland laws', () => { | ||
describe('functor', () => { | ||
it('should satisfy identity', () => { | ||
return Functor.identity(fulfill, assertSame, {}) | ||
}) | ||
|
||
it('should satisfy composition', () => { | ||
const f = x => x + 'f' | ||
const g = x => x + 'g' | ||
return Functor.composition(fulfill, assertSame, f, g, {}) | ||
}) | ||
}) | ||
|
||
describe('apply', () => { | ||
it('should satisfy composition', () => { | ||
return Apply.composition(fulfill, assertSame, {}) | ||
}) | ||
}) | ||
|
||
describe('applicative', () => { | ||
it('should satisfy identity', () => { | ||
return Applicative.identity(Promise, assertSame, {}) | ||
}) | ||
|
||
it('should satisfy homomorphism', () => { | ||
return Applicative.homomorphism(Promise, assertSame, {}) | ||
}) | ||
|
||
it('should satisfy interchange', () => { | ||
return Applicative.interchange(Promise, assertSame, {}) | ||
}) | ||
}) | ||
|
||
describe('chain', () => { | ||
it('should satisfy associativity', () => { | ||
return Chain.associativity(fulfill, assertSame, {}) | ||
}) | ||
}) | ||
|
||
describe('semigroup', () => { | ||
it('should satisfy associativity', () => { | ||
return Semigroup.associativity(fulfill, assertSame, {}) | ||
}) | ||
}) | ||
|
||
describe('monoid', () => { | ||
it('should satisfy rightIdentity', () => { | ||
return Monoid.rightIdentity(Promise, assertSame, {}) | ||
}) | ||
|
||
it('should satisfy leftIdentity', () => { | ||
return Monoid.leftIdentity(Promise, assertSame, {}) | ||
}) | ||
}) | ||
}) |