alsatian-test/alsatian

View on GitHub
packages/alsatian/core/decorators/test-fixture-decorator.ts

Summary

Maintainability
A
0 mins
Test Coverage
import "reflect-metadata";
import { TestFixture as TestFixtureMetadata } from "../";
import { TEST_FIXTURE } from "./_metadata-keys";
import { Constructor, INameable } from "../_interfaces";

export function TestFixture(description?: string) {
    return (constructor: Constructor) => {
        // create data about the test fixture
        // with the description either being the
        // given string or the class name
        const testFixtureMetadata = new TestFixtureMetadata(
            description || (constructor as INameable).name
        );

        // attach meta data to the class
        Reflect.defineMetadata(TEST_FIXTURE, testFixtureMetadata, constructor);
    };
}