@@ -38,8 +38,8 @@ describe('ui', () => {
38
38
const nxJson = readJsonInTree < NxJson > ( tree , '/nx.json' ) ;
39
39
expect ( nxJson . projects ) . toEqual ( {
40
40
'shared-ui-form-components' : {
41
- tags : [ 'domain:shared' , 'type:ui' ]
42
- }
41
+ tags : [ 'domain:shared' , 'type:ui' ] ,
42
+ } ,
43
43
} ) ;
44
44
} ) ;
45
45
@@ -53,8 +53,8 @@ describe('ui', () => {
53
53
const nxJson = readJsonInTree < NxJson > ( tree , '/nx.json' ) ;
54
54
expect ( nxJson . projects ) . toEqual ( {
55
55
'customer-ui-form-components' : {
56
- tags : [ 'domain:customer' , 'type:ui' ]
57
- }
56
+ tags : [ 'domain:customer' , 'type:ui' ] ,
57
+ } ,
58
58
} ) ;
59
59
} ) ;
60
60
@@ -82,10 +82,12 @@ describe('ui', () => {
82
82
) ;
83
83
84
84
const workspaceJson = readJsonInTree ( tree , '/workspace.json' ) ;
85
- expect ( workspaceJson . projects ) . toHaveProperty ( 'customer-forms-ui-form-components' ) ;
86
- expect ( workspaceJson . projects [ 'customer-forms-ui-form-components' ] . root ) . toEqual (
87
- 'libs/customer/forms/ui-form-components'
85
+ expect ( workspaceJson . projects ) . toHaveProperty (
86
+ 'customer-forms-ui-form-components'
88
87
) ;
88
+ expect (
89
+ workspaceJson . projects [ 'customer-forms-ui-form-components' ] . root
90
+ ) . toEqual ( 'libs/customer/forms/ui-form-components' ) ;
89
91
} ) ;
90
92
91
93
it ( 'should keep correct tags with a customized directory' , async ( ) => {
@@ -98,8 +100,51 @@ describe('ui', () => {
98
100
const nxJson = readJsonInTree < NxJson > ( tree , '/nx.json' ) ;
99
101
expect ( nxJson . projects ) . toEqual ( {
100
102
'customer-forms-ui-form-components' : {
101
- tags : [ 'domain:customer' , 'type:ui' ]
102
- }
103
+ tags : [ 'domain:customer' , 'type:ui' ] ,
104
+ } ,
103
105
} ) ;
104
106
} ) ;
107
+
108
+ it ( 'should add valid import path to publishable lib' , async ( ) => {
109
+ const tree = await runSchematic < UiOptions > (
110
+ 'ui' ,
111
+ { name : 'form-components' , shared : true , type : 'publishable' } ,
112
+ appTree
113
+ ) ;
114
+
115
+ let ngPackage = readJsonInTree (
116
+ tree ,
117
+ 'libs/shared/ui-form-components/ng-package.json'
118
+ ) ;
119
+ expect ( ngPackage ) . toBeDefined ( ) ;
120
+ const packageJson = readJsonInTree (
121
+ tree ,
122
+ 'libs/shared/ui-form-components/package.json'
123
+ ) ;
124
+ expect ( packageJson . name ) . toEqual ( '@proj/shared-ui-form-components' ) ;
125
+ } ) ;
126
+
127
+ it ( 'should add valid import path to publishable lib with customized directory' , async ( ) => {
128
+ const tree = await runSchematic < UiOptions > (
129
+ 'ui' ,
130
+ {
131
+ name : 'form-components' ,
132
+ shared : true ,
133
+ type : 'publishable' ,
134
+ directory : 'forms' ,
135
+ } ,
136
+ appTree
137
+ ) ;
138
+
139
+ let ngPackage = readJsonInTree (
140
+ tree ,
141
+ 'libs/shared/forms/ui-form-components/ng-package.json'
142
+ ) ;
143
+ expect ( ngPackage ) . toBeDefined ( ) ;
144
+ const packageJson = readJsonInTree (
145
+ tree ,
146
+ 'libs/shared/forms/ui-form-components/package.json'
147
+ ) ;
148
+ expect ( packageJson . name ) . toEqual ( '@proj/shared-forms-ui-form-components' ) ;
149
+ } ) ;
105
150
} ) ;
0 commit comments