Bones/node_modules/reflect-metadata/test/reflect/reflect-definemetadata.ts

17 lines
758 B
TypeScript
Raw Normal View History

2017-05-17 13:45:25 -04:00
// 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"));
}