Skip to content

Commit c96c7b6

Browse files
authored
Merge pull request #31 from secure-dashboards/feat/add-repositories
2 parents bd6452f + ad4b07b commit c96c7b6

File tree

4 files changed

+3645
-3771
lines changed

4 files changed

+3645
-3771
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,7 @@ dist
128128
.yarn/build-state.yml
129129
.yarn/install-state.gz
130130
.pnp.*
131+
132+
133+
# CUSTOM
134+
IGNORE/

__tests__/cli/workflows.test.js

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,21 @@ describe('list - Non-Interactive Mode', () => {
3232
})
3333
})
3434

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', () => {
3650
// Mock inquirer for testing
3751
jest.spyOn(inquirer, 'prompt').mockImplementation(async (questions) => {
3852
const questionMap = {
@@ -74,41 +88,3 @@ describe('run update-github-orgs - Interactive Mode', () => {
7488

7589
test.todo('Should throw an error when the Github API is not available')
7690
})
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-
})

src/schemas/githubListOrgRepos.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,10 @@
670670
"type": "string"
671671
},
672672
"url": {
673-
"type": "string"
673+
"type": [
674+
"string",
675+
"null"
676+
]
674677
},
675678
"node_id": {
676679
"type": "string"

0 commit comments

Comments
 (0)