1 | var chai = require('chai');
|
2 | var expect = require('chai').expect;
|
3 | var dream = require('../dream.js');
|
4 |
|
5 | dream.customType('pi', function () {
|
6 | return Math.PI;
|
7 | });
|
8 |
|
9 | dream.schema('customTypes', {
|
10 | namedCustomType: 'pi',
|
11 | genericCustomType: function () {
|
12 | return 'genericCustomType';
|
13 | },
|
14 | builtInCustomType: 'name',
|
15 | regExpCustomType: /REcustomType/
|
16 | });
|
17 |
|
18 | describe('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 | });
|