Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it(`should add metadata only once via wrapper`, () => {
expect(getMetadata(metadataKey, Engine)).toEqual(undefined)
const DecoratedEngine = optional(Engine)
const OriginalEngine = ((DecoratedEngine as any) as () => typeof Engine)()
expect(getMetadata(metadataKey, DecoratedEngine!)).toEqual({
optional: true,
})
expect(getMetadata(metadataKey, Engine)).toEqual(undefined)
expect(getMetadata(metadataKey, OriginalEngine)).toEqual(undefined)
expect(OriginalEngine).toBe(Engine)
})
it(`should add metadata only once via wrapper`, () => {
expect(getMetadata(metadataKey, Engine)).toEqual(undefined)
const DecoratedEngine = optional(Engine)
const OriginalEngine = ((DecoratedEngine as any) as () => typeof Engine)()
expect(getMetadata(metadataKey, DecoratedEngine!)).toEqual({
optional: true,
})
expect(getMetadata(metadataKey, Engine)).toEqual(undefined)
expect(getMetadata(metadataKey, OriginalEngine)).toEqual(undefined)
expect(OriginalEngine).toBe(Engine)
})
it(`should add metadata only once via wrapper`, () => {
expect(getMetadata(metadataKey, Engine)).toEqual(undefined)
const DecoratedEngine = optional(Engine)
const OriginalEngine = ((DecoratedEngine as any) as () => typeof Engine)()
expect(getMetadata(metadataKey, DecoratedEngine!)).toEqual({
optional: true,
})
expect(getMetadata(metadataKey, Engine)).toEqual(undefined)
expect(getMetadata(metadataKey, OriginalEngine)).toEqual(undefined)
expect(OriginalEngine).toBe(Engine)
})