Bones/node_modules/reflect-metadata/test/reflect/reflect-definemetadata.ts
SOUTHERNCO\x2mjbyrn 7efe7605b8 Template Upload
2017-05-17 13:45:25 -04:00

17 lines
758 B
TypeScript

// Reflect.defineMetadata ( metadataKey, metadataValue, target, propertyKey )
// - https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#reflectdefinemetadata--metadatakey-metadatavalue-target-propertykey-
import "../../Reflect";
import * as assert from "assert";
export function ReflectDefineMetadataInvalidTarget() {
assert.throws(() => Reflect.defineMetadata("key", "value", undefined, undefined), TypeError);
}
export function ReflectDefineMetadataValidTargetWithoutTargetKey() {
assert.doesNotThrow(() => Reflect.defineMetadata("key", "value", { }, undefined));
}
export function ReflectDefineMetadataValidTargetWithTargetKey() {
assert.doesNotThrow(() => Reflect.defineMetadata("key", "value", { }, "name"));
}