Skip to content

Commit cc06752

Browse files
committed
test: add project creation and update handlers
1 parent 28cd26f commit cc06752

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

__tests__/utils/index.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,20 @@ const resetDatabase = async (knex) => {
66
const getAllProjects = (knex) => knex('projects').select('*')
77
const getAllGithubOrgs = (knex) => knex('github_organizations').select('*')
88

9+
const addProject = async (knex, { name, category }) => {
10+
const [project] = await knex('projects').insert({ name, category }).returning('*')
11+
return project
12+
}
13+
14+
const addGithubOrg = async (knex, data) => {
15+
const [githubOrg] = await knex('github_organizations').insert(data).returning('*')
16+
return githubOrg
17+
}
18+
919
module.exports = {
1020
resetDatabase,
1121
getAllProjects,
12-
getAllGithubOrgs
22+
getAllGithubOrgs,
23+
addProject,
24+
addGithubOrg
1325
}

0 commit comments

Comments
 (0)