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

100% Statements 15/15
100% Branches 4/4
100% Functions 4/4
100% Lines 13/13
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  26×   110×   110× 18×       919× 50×         987× 110× 110×   110×      
"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
                }];
        }
        else if (tests.filter(function (test) { return test.key === propertyKey; }).length === 0) {
            tests.push({
                key: propertyKey
            });
        }
        // mark it as async and add the description
        var test = tests.filter(function (test) { return test.key === propertyKey; })[0];
        test.isAsync = true;
        test.description = description;
        // update the register
        Reflect.defineMetadata("alsatian:tests", tests, target);
    };
}
exports.AsyncTest = AsyncTest;
//# sourceMappingURL=async-test-decorator.js.map