Skip to content

Commit d520eec

Browse files
committed
test: extend utils to handle github_repositories table
1 parent 969b48e commit d520eec

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

__utils__/index.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const resetDatabase = async (knex) => {
2+
await knex.raw('TRUNCATE TABLE github_repositories RESTART IDENTITY CASCADE')
23
await knex.raw('TRUNCATE TABLE github_organizations RESTART IDENTITY CASCADE')
34
await knex.raw('TRUNCATE TABLE projects RESTART IDENTITY CASCADE')
45
}
@@ -16,10 +17,18 @@ const addGithubOrg = async (knex, data) => {
1617
return githubOrg
1718
}
1819

20+
const getAllGithubRepos = (knex) => knex('github_repositories').select('*')
21+
const addGithubRepo = async (knex, data) => {
22+
const [githubRepo] = await knex('github_repositories').insert(data).returning('*')
23+
return githubRepo
24+
}
25+
1926
module.exports = {
2027
resetDatabase,
2128
getAllProjects,
2229
getAllGithubOrgs,
2330
addProject,
24-
addGithubOrg
31+
addGithubOrg,
32+
getAllGithubRepos,
33+
addGithubRepo
2534
}

0 commit comments

Comments
 (0)