@@ -23,7 +23,7 @@ beforeEach(() => {
23
23
fetch . resetMocks ( )
24
24
command = new TheCommand ( [ ] )
25
25
command . config = {
26
- commands : [ { pluginName : 'baz' } ] ,
26
+ commands : [ { pluginName : '@adobe/aio-cli-plugin- baz' } ] ,
27
27
runCommand : jest . fn ( )
28
28
}
29
29
} )
@@ -39,8 +39,8 @@ describe('sorting', () => {
39
39
40
40
const expectedResult = {
41
41
objects : [
42
- { package : { scope : 'adobe' , name : 'foo' , description : 'some foo ' , version : '1.0.0' , date : genesis } } ,
43
- { package : { scope : 'adobe' , name : 'bar' , description : 'some bar ' , version : '1.0.1' , date : later } }
42
+ { package : { name : '@ adobe/aio-cli-plugin-a ' , description : 'plugin a ' , version : '1.0.0' , date : genesis } } ,
43
+ { package : { name : '@ adobe/aio-cli-plugin-b ' , description : 'plugin b ' , version : '1.0.1' , date : later } }
44
44
]
45
45
}
46
46
beforeEach ( ( ) => {
@@ -59,32 +59,32 @@ describe('sorting', () => {
59
59
command . argv = [ '--sort-field' , 'name' , '--sort-order' , 'asc' ]
60
60
await command . run ( )
61
61
const splitOutput = stdout . output . split ( '\n' )
62
- expect ( splitOutput [ 2 ] ) . toMatch ( 'bar ' ) // bar is first
63
- expect ( splitOutput [ 3 ] ) . toMatch ( 'foo ' ) // foo is second
62
+ expect ( splitOutput [ 2 ] ) . toMatch ( '@adobe/aio-cli-plugin-a ' ) // @adobe /aio-cli-plugin-a is first
63
+ expect ( splitOutput [ 3 ] ) . toMatch ( '@adobe/aio-cli-plugin-b ' ) // @adobe /aio-cli-plugin-b is second
64
64
} )
65
65
66
66
test ( 'sort-field=name, descending' , async ( ) => {
67
67
command . argv = [ '--sort-field' , 'name' , '--sort-order' , 'desc' ]
68
68
await command . run ( )
69
69
const splitOutput = stdout . output . split ( '\n' )
70
- expect ( splitOutput [ 2 ] ) . toMatch ( 'foo ' ) // foo is first
71
- expect ( splitOutput [ 3 ] ) . toMatch ( 'bar ' ) // bar is second
70
+ expect ( splitOutput [ 2 ] ) . toMatch ( '@adobe/aio-cli-plugin-b ' ) // @adobe /aio-cli-plugin-b is first
71
+ expect ( splitOutput [ 3 ] ) . toMatch ( '@adobe/aio-cli-plugin-a ' ) // @adobe /aio-cli-plugin-a is second
72
72
} )
73
73
74
74
test ( 'sort-field=date, ascending' , async ( ) => {
75
75
command . argv = [ '--sort-field' , 'date' , '--sort-order' , 'asc' ]
76
76
await command . run ( )
77
77
const splitOutput = stdout . output . split ( '\n' )
78
- expect ( splitOutput [ 2 ] ) . toMatch ( 'foo ' ) // foo is first
79
- expect ( splitOutput [ 3 ] ) . toMatch ( 'bar ' ) // bar is second
78
+ expect ( splitOutput [ 2 ] ) . toMatch ( '@adobe/aio-cli-plugin-a ' ) // @adobe /aio-cli-plugin-a is first
79
+ expect ( splitOutput [ 3 ] ) . toMatch ( '@adobe/aio-cli-plugin-b ' ) // @adobe /aio-cli-plugin-b is second
80
80
} )
81
81
82
82
test ( 'sort-field=date, descending' , async ( ) => {
83
83
command . argv = [ '--sort-field' , 'date' , '--sort-order' , 'desc' ]
84
84
await command . run ( )
85
85
const splitOutput = stdout . output . split ( '\n' )
86
- expect ( splitOutput [ 2 ] ) . toMatch ( 'bar ' ) // bar is first
87
- expect ( splitOutput [ 3 ] ) . toMatch ( 'foo ' ) // foo is second
86
+ expect ( splitOutput [ 2 ] ) . toMatch ( '@adobe/aio-cli-plugin-b ' ) // @adobe /aio-cli-plugin-b is first
87
+ expect ( splitOutput [ 3 ] ) . toMatch ( '@adobe/aio-cli-plugin-a ' ) // @adobe /aio-cli-plugin-a is second
88
88
} )
89
89
} )
90
90
@@ -95,30 +95,30 @@ test('interactive install', async () => {
95
95
96
96
const expectedResult = {
97
97
objects : [
98
- { package : { scope : 'adobe' , name : 'foo' , description : 'some foo' , version : '1.0.0' , date : now } } ,
99
- { package : { scope : 'adobe' , name : 'bar' , description : 'some bar' , version : '1.0.1' , date : tomorrow } } ,
100
- { package : { scope : 'adobe' , name : 'baz' , description : 'some baz' , version : '1.0.2' , date : dayAfter } }
98
+ { package : { name : '@adobe/aio-cli-plugin- foo' , description : 'some foo' , version : '1.0.0' , date : now } } ,
99
+ { package : { name : '@adobe/aio-cli-plugin- bar' , description : 'some bar' , version : '1.0.1' , date : tomorrow } } ,
100
+ { package : { name : '@adobe/aio-cli-plugin- baz' , description : 'some baz' , version : '1.0.2' , date : dayAfter } }
101
101
]
102
102
}
103
103
fetch . mockResponseOnce ( JSON . stringify ( expectedResult ) )
104
104
105
105
command . argv = [ '-i' ]
106
106
inquirer . prompt = jest . fn ( ) . mockResolvedValue ( {
107
- plugins : [ 'bar' , 'foo' ]
107
+ plugins : [ '@adobe/aio-cli-plugin- bar' , '@adobe/aio-cli-plugin- foo' ]
108
108
} )
109
109
110
110
const result = await command . run ( )
111
- expect ( result ) . toEqual ( [ 'bar' , 'foo' ] )
111
+ expect ( result ) . toEqual ( [ '@adobe/aio-cli-plugin- bar' , '@adobe/aio-cli-plugin- foo' ] )
112
112
const arg = inquirer . prompt . mock . calls [ 0 ] [ 0 ] // first arg of first call
113
- expect ( arg [ 0 ] . choices . map ( elem => elem . value ) ) . toEqual ( [ 'bar' , 'foo' ] ) // baz was an existing plugin, filtered out
113
+ expect ( arg [ 0 ] . choices . map ( elem => elem . value ) ) . toEqual ( [ '@adobe/aio-cli-plugin- bar' , '@adobe/aio-cli-plugin- foo' ] ) // @adobe /aio-cli-plugin- baz was an existing plugin, filtered out
114
114
} )
115
115
116
116
test ( 'interactive install - no choices' , async ( ) => {
117
117
const now = new Date ( )
118
118
119
119
const expectedResult = {
120
120
objects : [
121
- { package : { scope : 'adobe' , name : 'baz' , description : 'some baz' , version : '1.0.2' , date : now } }
121
+ { package : { name : '@adobe/aio-cli-plugin- baz' , description : 'some baz' , version : '1.0.2' , date : now } }
122
122
]
123
123
}
124
124
fetch . mockResponseOnce ( JSON . stringify ( expectedResult ) )
0 commit comments