1 |
|
2 | import {
|
3 | Model, Attribute, IModelOptions,
|
4 | IModelAttributeOptions
|
5 | } from "../decorations/ModelDecorations";
|
6 | import {TypeStoreAttrKey, TypeStoreModelKey} from "../Constants";
|
7 | import {getMetadata} from "../MetadataManager";
|
8 |
|
9 | @Model()
|
10 | class DecorationTest {
|
11 |
|
12 | @Attribute()
|
13 | myString:string
|
14 | }
|
15 |
|
16 | describe('#typestore',() => {
|
17 | describe('#model-decorations',() => {
|
18 |
|
19 | before(() => {
|
20 | new DecorationTest()
|
21 | })
|
22 |
|
23 | it("#hasModelOptions",() => {
|
24 | const md = getMetadata(TypeStoreModelKey,DecorationTest) as IModelOptions
|
25 | expect(md.clazz).toBe(DecorationTest)
|
26 | expect(md.clazzName).toBe('DecorationTest')
|
27 | expect(md.attrs.length).toBe(1)
|
28 | })
|
29 |
|
30 | it("#hasAttrOptions",() => {
|
31 | const md = getMetadata(TypeStoreAttrKey,DecorationTest,'myString') as IModelAttributeOptions
|
32 | expect(md.name).toBe('myString')
|
33 | expect(md.type).toBe(String)
|
34 | })
|
35 | })
|
36 | })
|