all files / core/decorators/ async-test-decorator.js

100% Statements 14/14
100% Branches 4/4
100% Functions 4/4
100% Lines 12/12
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  14×   98×   98× 14×         14×   904× 42×         42×     42×        
"use strict";
require("reflect-metadata");
function AsyncTest(description) {
    return function (target, propertyKey, descriptor) {
        // check if this has been registered as a test already
        var tests = Reflect.getMetadata("alsatian:tests", target);
        // if there are no tests registered yet then register it
        if (!tests) {
            tests = [{
                    key: propertyKey,
                    description: description,
                    isAsync: true
                }];
            Reflect.defineMetadata("alsatian:tests", tests, target);
        }
        else if (tests.filter(function (test) { return test.key === propertyKey; }).length === 0) {
            tests.push({
                key: propertyKey,
                description: description,
                isAsync: true
            });
            Reflect.defineMetadata("alsatian:tests", tests, target);
        }
        else {
            tests.filter(function (test) { return test.key === propertyKey; })[0].isAsync = true;
        }
    };
}
exports.AsyncTest = AsyncTest;
//# sourceMappingURL=async-test-decorator.js.map