@@ -35,7 +35,7 @@ describe('PublisherERS', () => {
35
35
// mock login
36
36
fetch . postOnce ( 'path:/api/auth/login' , { body : { token } , status : 200 } ) ;
37
37
// mock fetch all existing versions
38
- fetch . getOnce ( 'path:/api/version' , { body : [ { name : '2.0.0' , assets : [ ] , flavor : 'default' } ] , status : 200 } ) ;
38
+ fetch . getOnce ( 'path:/api/version' , { body : [ { name : '2.0.0' , assets : [ ] , flavor : { name : 'default' } } ] , status : 200 } ) ;
39
39
// mock creating a new version
40
40
fetch . postOnce ( 'path:/api/version' , { status : 200 } ) ;
41
41
// mock asset upload
@@ -65,7 +65,7 @@ describe('PublisherERS', () => {
65
65
66
66
// creates a new version with the correct flavor, name, and channel
67
67
expect ( calls [ 2 ] [ 0 ] ) . to . equal ( `${ baseUrl } /api/version` ) ;
68
- expect ( calls [ 2 ] [ 1 ] ?. body ) . to . equal ( `{"channel":{"name":" stable"} ,"flavor":"${ flavor } ","name":"${ version } ","notes":""}` ) ;
68
+ expect ( calls [ 2 ] [ 1 ] ?. body ) . to . equal ( `{"channel":" stable","flavor":"${ flavor } ","name":"${ version } ","notes":"","id":" ${ version } _stable "}` ) ;
69
69
70
70
// uploads asset successfully
71
71
expect ( calls [ 3 ] [ 0 ] ) . to . equal ( `${ baseUrl } /api/asset` ) ;
@@ -83,7 +83,7 @@ describe('PublisherERS', () => {
83
83
// mock login
84
84
fetch . postOnce ( 'path:/api/auth/login' , { body : { token } , status : 200 } ) ;
85
85
// mock fetch all existing versions
86
- fetch . getOnce ( 'path:/api/version' , { body : [ { name : '2.0.0' , assets : [ ] , flavor : 'lite' } ] , status : 200 } ) ;
86
+ fetch . getOnce ( 'path:/api/version' , { body : [ { name : '2.0.0' , assets : [ ] , flavor : { name : 'lite' } } ] , status : 200 } ) ;
87
87
// mock asset upload
88
88
fetch . post ( 'path:/api/asset' , { status : 200 } ) ;
89
89
@@ -123,7 +123,10 @@ describe('PublisherERS', () => {
123
123
// mock login
124
124
fetch . postOnce ( 'path:/api/auth/login' , { body : { token } , status : 200 } ) ;
125
125
// mock fetch all existing versions
126
- fetch . getOnce ( 'path:/api/version' , { body : [ { name : '2.0.0' , assets : [ { name : 'existing-artifact' } ] , flavor : 'default' } ] , status : 200 } ) ;
126
+ fetch . getOnce ( 'path:/api/version' , {
127
+ body : [ { name : '2.0.0' , assets : [ { name : 'existing-artifact' , platform : 'linux_64' } ] , flavor : { name : 'default' } } ] ,
128
+ status : 200 ,
129
+ } ) ;
127
130
128
131
const publisher = new PublisherERS ( {
129
132
baseUrl,
@@ -158,7 +161,7 @@ describe('PublisherERS', () => {
158
161
// mock login
159
162
fetch . postOnce ( 'path:/api/auth/login' , { body : { token } , status : 200 } ) ;
160
163
// mock fetch all existing versions
161
- fetch . getOnce ( 'path:/api/version' , { body : [ { name : '2.0.0' , assets : [ { name : 'existing-artifact' } ] , flavor : 'default' } ] , status : 200 } ) ;
164
+ fetch . getOnce ( 'path:/api/version' , { body : [ { name : '2.0.0' , assets : [ { name : 'existing-artifact' } ] , flavor : { name : 'default' } } ] , status : 200 } ) ;
162
165
// mock creating a new version
163
166
fetch . postOnce ( 'path:/api/version' , { status : 200 } ) ;
164
167
// mock asset upload
@@ -188,7 +191,7 @@ describe('PublisherERS', () => {
188
191
189
192
// creates a new version with the correct flavor, name, and channel
190
193
expect ( calls [ 2 ] [ 0 ] ) . to . equal ( `${ baseUrl } /api/version` ) ;
191
- expect ( calls [ 2 ] [ 1 ] ?. body ) . to . equal ( `{"channel":{"name":" stable"} ,"flavor":"${ flavor } ","name":"${ version } ","notes":""}` ) ;
194
+ expect ( calls [ 2 ] [ 1 ] ?. body ) . to . equal ( `{"channel":" stable","flavor":"${ flavor } ","name":"${ version } ","notes":"","id":" ${ version } _stable "}` ) ;
192
195
193
196
// uploads asset successfully
194
197
expect ( calls [ 3 ] [ 0 ] ) . to . equal ( `${ baseUrl } /api/asset` ) ;
0 commit comments