This commit is contained in:
2017-01-17 15:28:28 +01:00
parent f55ebefffb
commit de3f582226
7 changed files with 119 additions and 1 deletions

1
test/test.d.ts vendored Normal file
View File

@ -0,0 +1 @@
import 'typings-test';

23
test/test.js Normal file
View File

@ -0,0 +1,23 @@
"use strict";
require("typings-test");
const should = require("should");
const q = require("../dist/index");
describe('smartq', function () {
it('should return a Deferred for .defer()', function (done) {
let myDeferred = q.defer();
myDeferred.promise.then(() => {
done();
});
myDeferred.resolve();
});
it('should let types flow through the Promise', function (done) {
let myString = 'someString';
let myDeferred = q.defer();
myDeferred.promise.then(x => {
should(x).equal('someString');
done();
});
myDeferred.resolve(myString);
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUVyQixpQ0FBZ0M7QUFDaEMsbUNBQWtDO0FBRWxDLFFBQVEsQ0FBQyxRQUFRLEVBQUU7SUFDZixFQUFFLENBQUMsdUNBQXVDLEVBQUUsVUFBUyxJQUFJO1FBQ3JELElBQUksVUFBVSxHQUFHLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtRQUMxQixVQUFVLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQztZQUNwQixJQUFJLEVBQUUsQ0FBQTtRQUNWLENBQUMsQ0FBQyxDQUFBO1FBQ0YsVUFBVSxDQUFDLE9BQU8sRUFBRSxDQUFBO0lBQ3hCLENBQUMsQ0FBQyxDQUFBO0lBRUYsRUFBRSxDQUFDLDJDQUEyQyxFQUFFLFVBQVMsSUFBSTtRQUN6RCxJQUFJLFFBQVEsR0FBRyxZQUFZLENBQUE7UUFDM0IsSUFBSSxVQUFVLEdBQUcsQ0FBQyxDQUFDLEtBQUssRUFBVSxDQUFBO1FBQ2xDLFVBQVUsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7WUFDckIsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQyxZQUFZLENBQUMsQ0FBQTtZQUM3QixJQUFJLEVBQUUsQ0FBQTtRQUNWLENBQUMsQ0FBQyxDQUFBO1FBQ0YsVUFBVSxDQUFDLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQTtJQUNoQyxDQUFDLENBQUMsQ0FBQTtBQUNOLENBQUMsQ0FBQyxDQUFBIn0=

24
test/test.ts Normal file
View File

@ -0,0 +1,24 @@
import 'typings-test'
import * as should from 'should'
import * as q from '../dist/index'
describe('smartq', function() {
it('should return a Deferred for .defer()', function(done) {
let myDeferred = q.defer()
myDeferred.promise.then(() => {
done()
})
myDeferred.resolve()
})
it('should let types flow through the Promise', function(done) {
let myString = 'someString'
let myDeferred = q.defer<string>()
myDeferred.promise.then(x => {
should(x).equal('someString')
done()
})
myDeferred.resolve(myString)
})
})