Skip to content

Commit

Permalink
Feat(tenant): Update tests for admin url instance
Browse files Browse the repository at this point in the history
  • Loading branch information
arimet committed Sep 21, 2023
1 parent c01a67b commit 6b05fe2
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cypress/support/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const goToAdminDashboard = () => {
cy.get('.advanced-page a')
.contains('Admin')
.click();
cy.location('pathname').should('equal', '/admin');
cy.location('pathname').should('equal', '/instance/default/admin');
};

export const goToHomePage = () => {
Expand Down
2 changes: 1 addition & 1 deletion globalConfig.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"mongoUri":"mongodb://127.0.0.1:43907/jest?","mongoDBName":"jest"}
{"mongoUri":"mongodb://127.0.0.1:36595/jest?","mongoDBName":"jest"}
8 changes: 7 additions & 1 deletion src/api/controller/api/publish.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { doPublish } from './publish';
import { PUBLISHER } from '../../workers/publisher';
import { workerQueues } from '../../workers';
jest.mock('../../workers');
jest.mock('../../workers', () => ({
workerQueues: {
lodex_test: {
add: jest.fn(),
},
},
}));

describe.skip('publish', () => {
describe('doPublish', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/api/e2e/publishedDataset.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
loadFixtures,
close,
} from '../../common/tests/fixtures';
import { closeAllWorkerQueues } from '../workers';

const adminHeader = {
cookie: `lodex_token=${jwt.sign(
Expand Down Expand Up @@ -390,6 +391,7 @@ describe('e2e publishedDataset Authentication', () => {
});

afterAll(async () => {
await closeAllWorkerQueues();
server.close();
await clear();
await close();
Expand Down
2 changes: 2 additions & 0 deletions src/api/e2e/ssr.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
loadFixtures,
close,
} from '../../common/tests/fixtures';
import { closeAllWorkerQueues } from '../workers';

const authentifiedHeader = {
cookie: `lodex_token=${jwt.sign(
Expand Down Expand Up @@ -253,6 +254,7 @@ describe('ssr', () => {
});

afterAll(async () => {
await closeAllWorkerQueues();
server.close();
await clear();
await close();
Expand Down
4 changes: 2 additions & 2 deletions src/api/workers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export const cleanWaitingJobsOfType = (queueName, jobType) => {

export const closeAllWorkerQueues = async () => {
await Promise.all(
workerQueues.map(async workerQueue => {
await workerQueue.close();
Object.keys(workerQueues).map(queueName => {
workerQueues[queueName].close();
}),
);
};
2 changes: 1 addition & 1 deletion src/app/js/public/menu/MenuItem.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ describe('MenuItem', () => {

const link = wrapper.find('a');

expect(link.prop('href')).toBe('/admin');
expect(link.prop('href')).toBe('/instance/default/admin');
});

it('should not render MenuItem when role is not admin', () => {
Expand Down

0 comments on commit 6b05fe2

Please sign in to comment.