UNPKG

496 BJavaScriptView Raw
1var assert = require('assert');
2var dg = require( '../lib/dg.js' );
3var test = [ 'test', 'another test', 1234, 'a string' ];
4
5it( 'Expression (asynchronous): object returned', function () {
6 dg.async( test, new RegExp( '^test$' ) ).then(
7 function (r) {
8 assert( typeof r, 'object' )
9 }
10 )
11} );
12
13it( 'Function (asynchronous): correct value returned', function () {
14 dg.async( test, function (t) { if ( t == 'test' ) return 1 }, function (r) {
15 assert.equal( r, [ 'test' ] )
16 } ) }
17);