Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('equals', () => {
const Astrid = stage().theActorCalled('Astrid');
class Name extends TinyTypeOf() {}
given([
{ description: 'string', expected: 'hello', actual: 'hello' },
{ description: 'number', expected: 42, actual: 42 },
{ description: 'boolean', expected: false, actual: false },
{ description: 'object', expected: { k: 'v' }, actual: { k: 'v' } },
{ description: 'TinyType', expected: new Name('Jan'), actual: new Name('Jan') },
{ description: 'array', expected: [ null, 2, '3' ], actual: [ null, 2, '3' ] },
{ description: 'Date', expected: new Date('Jan 27, 2019'), actual: new Date('Jan 27, 2019') },
]).
it('compares the value of "actual" and "expected" and allows for the actor flow to continue when they match', ({ actual, expected }) => {
return expect(Astrid.attemptsTo(
Ensure.that(actual, equals(expected)),
)).to.be.fulfilled;
});
import { TinyType, TinyTypeOf } from 'tiny-types';
export class FileExtension extends TinyTypeOf() {
static JSON = new FileExtension('json');
static PNG = new FileExtension('png');
static fromJSON = (v: string) => new FileExtension(v);
}
import { TinyType, TinyTypeOf } from 'tiny-types';
export class MimeType extends TinyTypeOf() {
public static Application_JSON = new MimeType('application/json');
public static Image_PNG = new MimeType('image/png');
public static fromJSON = (v: string) => new MimeType(v);
}