2019-02-06 05:42:35 +01:00
|
|
|
import * as assert from 'assert';
|
2022-09-17 20:27:08 +02:00
|
|
|
import { just, nothing } from '../../src/misc/prelude/maybe.js';
|
2019-02-06 05:42:35 +01:00
|
|
|
|
|
|
|
describe('just', () => {
|
|
|
|
it('has a value', () => {
|
|
|
|
assert.deepStrictEqual(just(3).isJust(), true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('has the inverse called get', () => {
|
|
|
|
assert.deepStrictEqual(just(3).get(), 3);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('nothing', () => {
|
|
|
|
it('has no value', () => {
|
|
|
|
assert.deepStrictEqual(nothing().isJust(), false);
|
|
|
|
});
|
|
|
|
});
|