Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

Commit

Permalink
chore(tests): supprime la libraire obsolète knex-db-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBitard authored and vmaubert committed Mar 21, 2022
1 parent 0e164d1 commit 2851964
Show file tree
Hide file tree
Showing 35 changed files with 214 additions and 363 deletions.
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"@types/node": "^17.0.21",
"@types/node-fetch": "^2.5.12",
"@types/node-mailjet": "^3.3.8",
"@types/pg": "^8.6.5",
"@types/proj4": "^2.5.2",
"@types/shpjs": "^3.4.1",
"@types/sql-formatter": "^2.3.0",
Expand Down
8 changes: 4 additions & 4 deletions src/business/utils/titre-slug-and-relations-update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { dbManager } from '../../../tests/db-manager'
import { ITitre } from '../../types'
import Titres from '../../database/models/titres'
import { objectClone } from '../../tools'

const knex = dbManager.getKnex()
beforeAll(async () => {
await dbManager.populateDb()
await dbManager.populateDb(knex)
})

afterAll(async () => {
await dbManager.truncateDb()
await dbManager.closeKnex()
await dbManager.truncateDb(knex)
await dbManager.closeKnex(knex)
})

const titreAdd = async (titre: ITitre) =>
Expand Down
10 changes: 7 additions & 3 deletions src/database/queries/permissions/administrations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ import options from '../_options'

console.info = jest.fn()
console.error = jest.fn()
const knex = dbManager.getKnex()

beforeAll(async () => {
await dbManager.populateDb()
console.log('BEFORE ALL')
await dbManager.populateDb(knex)
console.log('AFTER BEFORE ALL')
})

afterAll(async () => {
await dbManager.truncateDb()
await dbManager.closeKnex()
await dbManager.truncateDb(knex)
await dbManager.closeKnex(knex)
})

describe('administrationsTitresQuery', () => {
Expand All @@ -35,6 +38,7 @@ describe('administrationsTitresQuery', () => {
`(
"Vérifie l'écriture de la requête sur les titres dont une administration a des droits sur le type",
async ({ gestionnaire, associee, visible }) => {
console.log('PLOOOOOOP')
await Titres.query().delete()
await AdministrationsTitresTypes.query().delete()

Expand Down
9 changes: 4 additions & 5 deletions src/database/queries/permissions/documents.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { knex } from '../../../knex'
import { dbManager } from '../../../../tests/db-manager'

import { userSuper } from '../../user-super'
Expand All @@ -14,14 +13,14 @@ import { etapeTypeDocumentTypeUsedCheck } from './documents'

console.info = jest.fn()
console.error = jest.fn()

const knex = dbManager.getKnex()
beforeAll(async () => {
await dbManager.populateDb()
await dbManager.populateDb(knex)
})

afterAll(async () => {
await dbManager.truncateDb()
await dbManager.closeKnex()
await dbManager.truncateDb(knex)
await dbManager.closeKnex(knex)
})

describe('documentSupprimer', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/database/queries/permissions/entreprises.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { entreprisesQueryModify } from './entreprises'

console.info = jest.fn()
console.error = jest.fn()

const knex = dbManager.getKnex()
beforeAll(async () => {
await dbManager.populateDb()
await dbManager.populateDb(knex)
})

afterAll(async () => {
await dbManager.truncateDb()
await dbManager.closeKnex()
await dbManager.truncateDb(knex)
await dbManager.closeKnex(knex)
})

describe('entreprisesQueryModify', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/database/queries/permissions/metas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import Administrations from '../../models/administrations'

console.info = jest.fn()
console.error = jest.fn()

const knex = dbManager.getKnex()
beforeAll(async () => {
await dbManager.populateDb()
await dbManager.populateDb(knex)
})

afterAll(async () => {
await dbManager.truncateDb()
await dbManager.closeKnex()
await dbManager.truncateDb(knex)
await dbManager.closeKnex(knex)
})

describe('metas permissions queries', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/database/queries/permissions/titres.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ import { userSuper } from '../../user-super'

console.info = jest.fn()
console.error = jest.fn()

const knex = dbManager.getKnex()
beforeAll(async () => {
await dbManager.populateDb()
await dbManager.populateDb(knex)
})

afterAll(async () => {
await dbManager.truncateDb()
await dbManager.closeKnex()
await dbManager.truncateDb(knex)
await dbManager.closeKnex(knex)
})

describe('titresQueryModify', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/database/queries/permissions/utilisateurs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { utilisateursGet } from '../utilisateurs'

console.info = jest.fn()
console.error = jest.fn()

const knex = dbManager.getKnex()
beforeAll(async () => {
await dbManager.populateDb()
await dbManager.populateDb(knex)
})

afterAll(async () => {
await dbManager.truncateDb()
await dbManager.closeKnex()
await dbManager.truncateDb(knex)
await dbManager.closeKnex(knex)
})

const mockAdministration = {
Expand Down
8 changes: 4 additions & 4 deletions src/database/queries/titres-activites.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import Titres from '../models/titres'
import AdministrationsTitresTypes from '../models/administrations-titres-types'
console.info = jest.fn()
console.error = jest.fn()

const knex = dbManager.getKnex()
beforeAll(async () => {
await dbManager.populateDb()
await dbManager.populateDb(knex)
})

afterAll(async () => {
await dbManager.truncateDb()
await dbManager.closeKnex()
await dbManager.truncateDb(knex)
await dbManager.closeKnex(knex)
})
describe('teste les requêtes sur les activités', () => {
test('vérifie que le filtrage fonctionne pour les administrations', async () => {
Expand Down
3 changes: 0 additions & 3 deletions src/knex/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ const knexConfig = {
// https://github.com/knex/knex/issues/4688
extension: 'js'
},
seeds: {
directory: join(__dirname, './seeds')
},
...knexSnakeCaseMappers()
}

Expand Down
115 changes: 0 additions & 115 deletions src/knex/seeds/00-delete.js

This file was deleted.

22 changes: 0 additions & 22 deletions src/knex/seeds/10-entreprises.js

This file was deleted.

15 changes: 0 additions & 15 deletions src/knex/seeds/11-utilisateurs.js

This file was deleted.

Loading

0 comments on commit 2851964

Please sign in to comment.