UNPKG

1.01 kBJavaScriptView Raw
1var chai = require('chai');
2var expect = require('chai').expect;
3var dream = require('../dream.js');
4
5dream.customType('pi', function () {
6 return Math.PI;
7});
8
9dream.schema('customTypes', {
10 namedCustomType: 'pi',
11 genericCustomType: function () {
12 return 'genericCustomType';
13 },
14 builtInCustomType: 'name',
15 regExpCustomType: /REcustomType/
16});
17
18describe('Dream', function () {
19 describe('customTypes', function () {
20 it('should display correctly generated values for the custom types', function () {
21 expect(dream.useSchema('customTypes').generateRnd().output().namedCustomType).to.equal(3.141592653589793);
22 expect(dream.useSchema('customTypes').generateRnd().output().genericCustomType).to.equal('genericCustomType');
23 expect(dream.useSchema('customTypes').generateRnd().output().builtInCustomType).to.be.a('string');
24 expect(dream.useSchema('customTypes').generateRnd().output().regExpCustomType).to.equal('REcustomType');
25 });
26 });
27});