1
1
const nock = require ( 'nock' )
2
2
const commonTests = require ( '../../common-tests' )
3
- const yargsModule = require ( '../../../src/commands/topics /remove' )
3
+ const yargsModule = require ( '../../../src/commands/repos /remove-topics ' )
4
4
5
5
beforeEach ( ( ) => {
6
6
jest
@@ -20,11 +20,11 @@ afterEach(() => {
20
20
/**
21
21
* Common Yargs tests
22
22
*/
23
- const command = 'topics remove'
23
+ const command = 'repos remove-topics '
24
24
const requiredArguments = {
25
25
options : {
26
26
token : 'Test-Token' ,
27
- topic : 'hello' ,
27
+ topics : [ 'hello' ] ,
28
28
} ,
29
29
positionals : {
30
30
'github-url' : 'https://github.com/Test-Owner/Test-Repo' ,
@@ -33,7 +33,7 @@ const requiredArguments = {
33
33
commonTests . describeYargs ( yargsModule , command , requiredArguments )
34
34
35
35
describe ( 'Remove topic' , ( ) => {
36
- test ( 'triggers a network requests on the GitHub API' , async ( ) => {
36
+ test ( 'triggers network requests on the GitHub API' , async ( ) => {
37
37
nock ( 'https://api.github.com' )
38
38
. get ( '/repos/Test-Owner/Test-Repo/topics' )
39
39
. reply ( 200 , {
@@ -50,7 +50,7 @@ describe('Remove topic', () => {
50
50
const args = {
51
51
token : 'Test-Token' ,
52
52
githubUrl : { owner : 'Test-Owner' , repo : 'Test-Repo' } ,
53
- topic : 'app' ,
53
+ topics : [ 'app' ] ,
54
54
}
55
55
56
56
await yargsModule . handler ( args )
@@ -72,7 +72,7 @@ describe('Remove topic', () => {
72
72
const args = {
73
73
token : 'Test-Token' ,
74
74
githubUrl : { owner : 'Test-Owner' , repo : 'Test-Repo' } ,
75
- topic : 'hello' ,
75
+ topics : [ 'hello' ] ,
76
76
}
77
77
await yargsModule . handler ( args )
78
78
expect ( console . log ) . toBeCalledWith ( '' )
@@ -93,7 +93,7 @@ describe('Remove topic', () => {
93
93
const args = {
94
94
token : 'Test-Token' ,
95
95
githubUrl : { owner : 'Test-Owner' , repo : 'Test-Repo' } ,
96
- topic : 'app' ,
96
+ topics : [ 'app' ] ,
97
97
}
98
98
await yargsModule . handler ( args )
99
99
expect ( console . log ) . toBeCalledWith ( 'customer-products\nnew' )
@@ -117,7 +117,7 @@ describe('Error output', () => {
117
117
const args = {
118
118
token : 'Test-Token' ,
119
119
githubUrl : { owner : 'Test-Owner' , repo : 'Test-Repo' } ,
120
- topic : 'customer-products' ,
120
+ topics : [ 'customer-products' ] ,
121
121
}
122
122
await yargsModule . handler ( args )
123
123
expect ( errorResponse . isDone ( ) ) . toBe ( true )
@@ -137,7 +137,7 @@ describe('Error output', () => {
137
137
const args = {
138
138
token : 'Test-Token' ,
139
139
githubUrl : { owner : 'Test-Owner' , repo : 'Test-Repo' } ,
140
- topic : 'customer-products' ,
140
+ topics : [ 'customer-products' ] ,
141
141
}
142
142
await yargsModule . handler ( args )
143
143
expect ( console . log ) . toBeCalledWith ( expect . stringMatching ( / N o t f o u n d / i) )
0 commit comments