@@ -32,7 +32,21 @@ describe('list - Non-Interactive Mode', () => {
32
32
} )
33
33
} )
34
34
35
- describe ( 'run update-github-orgs - Interactive Mode' , ( ) => {
35
+ describe ( 'run GENERIC - Non-Interactive Mode' , ( ) => {
36
+ test ( 'Should throw an error when invalid name is provided' , async ( ) => {
37
+ await expect ( runWorkflowCommand ( knex , { name : 'invented' } ) )
38
+ . rejects
39
+ . toThrow ( 'Invalid workflow name. Please enter a valid workflow name.' )
40
+ } )
41
+
42
+ test ( 'Should throw an error when no name is provided' , async ( ) => {
43
+ await expect ( runWorkflowCommand ( knex , { name : undefined } ) )
44
+ . rejects
45
+ . toThrow ( 'Invalid workflow name. Please enter a valid workflow name.' )
46
+ } )
47
+ } )
48
+
49
+ describe ( 'run update-github-orgs' , ( ) => {
36
50
// Mock inquirer for testing
37
51
jest . spyOn ( inquirer , 'prompt' ) . mockImplementation ( async ( questions ) => {
38
52
const questionMap = {
@@ -74,41 +88,3 @@ describe('run update-github-orgs - Interactive Mode', () => {
74
88
75
89
test . todo ( 'Should throw an error when the Github API is not available' )
76
90
} )
77
-
78
- describe ( 'run update-github-orgs - Non-Interactive Mode' , ( ) => {
79
- // Mock inquirer for testing
80
- jest . spyOn ( inquirer , 'prompt' ) . mockImplementation ( async ( questions ) => {
81
- const questionMap = {
82
- 'What is the name of the workflow?' : 'update-github-orgs'
83
- }
84
- return questions . reduce ( ( acc , question ) => {
85
- acc [ question . name ] = questionMap [ question . message ]
86
- return acc
87
- } , { } )
88
- } )
89
-
90
- test ( 'Should throw an error when invalid name is provided' , async ( ) => {
91
- await expect ( runWorkflowCommand ( knex , { name : 'invented' } ) )
92
- . rejects
93
- . toThrow ( 'Invalid workflow name. Please enter a valid workflow name.' )
94
- } )
95
-
96
- test ( 'Should throw an error when no name is provided' , async ( ) => {
97
- await expect ( runWorkflowCommand ( knex , { name : undefined } ) )
98
- . rejects
99
- . toThrow ( 'Invalid workflow name. Please enter a valid workflow name.' )
100
- } )
101
-
102
- test ( 'Should throw an error when no Github orgs are stored in the database' , async ( ) => {
103
- const projects = await getAllProjects ( knex )
104
- expect ( projects . length ) . toBe ( 0 )
105
- const githubOrgs = await getAllGithubOrgs ( knex )
106
- expect ( githubOrgs . length ) . toBe ( 0 )
107
- await expect ( runWorkflowCommand ( knex , { name : 'update-github-orgs' } ) )
108
- . rejects
109
- . toThrow ( 'No organizations found. Please add organizations/projects before running this workflow.' )
110
- } )
111
-
112
- test . todo ( 'Should update the project with new information available' )
113
- test . todo ( 'Should throw an error when the Github API is not available' )
114
- } )
0 commit comments