diff --git a/src/api/e2e/publishedDataset.spec.js b/src/api/e2e/publishedDataset.spec.js index afbcfe3cf..db0de199f 100644 --- a/src/api/e2e/publishedDataset.spec.js +++ b/src/api/e2e/publishedDataset.spec.js @@ -50,8 +50,8 @@ describe('e2e publishedDataset Authentication', () => { beforeAll(async () => { server = requestServer(); - await clear(); - await connect(); + await clear('lodex_test'); + await connect('lodex_test'); await loadFixtures(fixtures); }); @@ -393,9 +393,9 @@ describe('e2e publishedDataset Authentication', () => { afterAll(async () => { server.close(); - await clear(); + await clear('lodex_test'); await close(); - const db = await mongoClient(); + const db = await mongoClient('lodex_test'); db.close(); }); }); diff --git a/src/api/e2e/ssr.spec.js b/src/api/e2e/ssr.spec.js index d4d1c6652..b26f0c09f 100644 --- a/src/api/e2e/ssr.spec.js +++ b/src/api/e2e/ssr.spec.js @@ -20,6 +20,9 @@ const authentifiedHeader = { }, auth.cookieSecret, )}`, + headers: { + 'X-Lodex-Tenant': 'lodex_test', + }, }; describe('ssr', () => { @@ -31,8 +34,8 @@ describe('ssr', () => { }); beforeEach(async () => { - await clear(); - await connect(); + await clear('lodex_test'); + await connect('lodex_test'); await loadFixtures(fixtures); }); @@ -126,9 +129,7 @@ describe('ssr', () => { }); it('should redirect to login', () => { - expect(state.router.location.pathname).toBe( - '/intance/lodex_test/login', - ); + expect(state.router.location.pathname).toBe('/login'); }); it('should not preload the dataset for home', () => { @@ -228,9 +229,7 @@ describe('ssr', () => { }); it('should redirect to login', () => { - expect(state.router.location.pathname).toEqual( - '/intance/lodex_test/login', - ); + expect(state.router.location.pathname).toEqual('/login'); }); it('should not preload fields', () => { @@ -259,13 +258,13 @@ describe('ssr', () => { }); afterEach(async () => { - await clear(); + await clear('lodex_test'); await close(); }); afterAll(async () => { server.close(); - const db = await mongoClient(); + const db = await mongoClient('lodex_test'); db.close(); }); }); diff --git a/src/api/services/saveParsedStream-e2e.spec.js b/src/api/services/saveParsedStream-e2e.spec.js index 8bc382386..0ba8bfde1 100644 --- a/src/api/services/saveParsedStream-e2e.spec.js +++ b/src/api/services/saveParsedStream-e2e.spec.js @@ -107,7 +107,7 @@ const fixtures = { describe('e2e upload saveparsedStream', () => { let db; beforeAll(async () => { - db = await connect(); + db = await connect('lodex_test'); }); describe('optimal', () => { @@ -211,7 +211,7 @@ describe('e2e upload saveparsedStream', () => { }); afterAll(async () => { - await clear(); + await clear('lodex_test'); }); }); @@ -311,7 +311,7 @@ describe('e2e upload saveparsedStream', () => { }); afterAll(async () => { - await clear(); + await clear('lodex_test'); }); }); diff --git a/src/common/tests/fixtures.js b/src/common/tests/fixtures.js index 92b20a388..e24667a3f 100644 --- a/src/common/tests/fixtures.js +++ b/src/common/tests/fixtures.js @@ -7,9 +7,9 @@ import mongoClient from '../../api/services/mongoClient'; let db; -export async function connect() { +export async function connect(tenant) { if (!db) { - db = await mongoClient(); + db = await mongoClient(tenant); db.dataset = await datasetFactory(db); db.publishedDataset = await publishedDatasetFactory(db); db.publishedCharacteristic = await publishedCharacteristicFactory(db); @@ -48,8 +48,8 @@ export function loadFixtures(fixtures) { return Promise.all(promises); } -export async function clear() { - await connect(); +export async function clear(tenant) { + await connect(tenant); await Promise.all([ db.dataset.remove({}),