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

100% Statements 20/20
100% Branches 6/6
100% Functions 3/3
100% Lines 19/19
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 31 32 33  210× 210× 332×   210× 210× 210×       882× 23×     23×   210× 210× 27×   210×     210×      
"use strict";
require("reflect-metadata");
function TestCase() {
    var testCaseArguments = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        testCaseArguments[_i - 0] = arguments[_i];
    }
    return function (target, propertyKey, descriptor) {
        var tests = Reflect.getMetadata("alsatian:tests", target);
        if (!tests) {
            tests = [{
                    key: propertyKey
                }];
            Reflect.defineMetadata("alsatian:tests", tests, target);
        }
        else if (tests.filter(function (test) { return test.key === propertyKey; }).length === 0) {
            tests.push({
                key: propertyKey
            });
            Reflect.defineMetadata("alsatian:tests", tests, target);
        }
        var testCases = Reflect.getMetadata("alsatian:testcases", target, propertyKey);
        if (!testCases) {
            testCases = [];
        }
        testCases.unshift({
            arguments: testCaseArguments
        });
        Reflect.defineMetadata("alsatian:testcases", testCases, target, propertyKey);
    };
}
exports.TestCase = TestCase;
//# sourceMappingURL=test-case-decorator.js.map