Skip to content

Commit

Permalink
VR-68: prettier and removing seeds path from knexfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulius Michelevicius authored and Paulius Michelevicius committed May 8, 2024
1 parent 4d52621 commit f7b3223
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
3 changes: 0 additions & 3 deletions knexfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ const pgConfig = {
migrations: {
tableName: 'migrations',
},
seeds: {
directory: './seeds/',
},
}

module.exports = {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"db:migrate": "npm run db:cmd -- migrate:latest",
"db:rollback": "npm run db:cmd -- migrate:rollback",
"db:seed": "npm run db:cmd -- seed:run",
"lint": "prettier -c ./src",
"lint": "prettier -c ./src ./test ./seeds ./migrations",
"lint:fix": "npm run lint -- -w",
"xss-scan": "xss-scan"
},
"dependencies": {
Expand Down
17 changes: 13 additions & 4 deletions seeds/connections-seed.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
// Currently based of statuses, variants, should cover all possible scenarios within table boundries

const company_name = 'Seeded company_name Name'
const variants = [{ status: 'pending', company_name }, { status: 'pending', company_name: '_@@$@*@&%£*&@£*$*(@£*$)@£*&' }, { status: 'unverified', company_name: 0 }, { status: 'unverified', company_name },{ status: 'verified_them', company_name }, { status: 'verified_us', company_name }, { status: 'verified_both', company_name }, { status: 'disconnected', company_name }]
const variants = [
{ status: 'pending', company_name },
{ status: 'pending', company_name: '_@@$@*@&%£*&@£*$*(@£*$)@£*&' },
{ status: 'unverified', company_name: 0 },
{ status: 'unverified', company_name },
{ status: 'verified_them', company_name },
{ status: 'verified_us', company_name },
{ status: 'verified_both', company_name },
{ status: 'disconnected', company_name },
]

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
* @returns { Promise<void> }
*/
exports.seed = async function(knex) {
exports.seed = async function (knex) {
// Deletes ALL existing entries
await knex('connection').del()
await Promise.all(variants.map(({ status, company_name }) => knex('connection').insert([{ status, company_name}])))
await Promise.all(variants.map(({ status, company_name }) => knex('connection').insert([{ status, company_name }])))
}
8 changes: 2 additions & 6 deletions test/mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
"timeout": 5000,
"exit": true,
"extension": "ts",
"file": [
"test/init.ts"
],
"node-option": [
"import=tsimp/import"
]
"file": ["test/init.ts"],
"node-option": ["import=tsimp/import"]
}

0 comments on commit f7b3223

Please sign in to comment.