test(API): Fix issues with Public API tests (#3515)

This commit is contained in:
Ricardo Espinoza 2022-06-18 01:20:21 -04:00 committed by GitHub
parent 189009a8b7
commit c4b63fa999
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View file

@ -19,6 +19,8 @@ let credentialOwnerRole: Role;
let saveCredential: SaveCredentialFunction;
jest.mock('../../../src/telemetry');
beforeAll(async () => {
app = await utils.initTestServer({ endpointGroups: ['publicApi'], applyAuth: false });
const initResult = await testDb.init();

View file

@ -8,6 +8,8 @@ import { randomApiKey } from '../shared/random';
import * as utils from '../shared/utils';
import * as testDb from '../shared/testDb';
jest.mock('../../../src/telemetry');
let app: express.Application;
let testDbName = '';
let globalOwnerRole: Role;

View file

@ -16,6 +16,8 @@ let globalMemberRole: Role;
let workflowOwnerRole: Role;
let workflowRunner: ActiveWorkflowRunner.ActiveWorkflowRunner;
jest.mock('../../../src/telemetry');
beforeAll(async () => {
app = await utils.initTestServer({ endpointGroups: ['publicApi'], applyAuth: false });
const initResult = await testDb.init();
@ -34,6 +36,7 @@ beforeAll(async () => {
utils.initTestTelemetry();
utils.initTestLogger();
await utils.initNodeTypes();
await utils.initConfigFile();
workflowRunner = await utils.initActiveWorkflowRunner();
});
@ -648,7 +651,7 @@ test('POST /workflows/:id/activate should fail due to trying to activate a workf
expect(response.statusCode).toBe(400);
});
test.skip('POST /workflows/:id/activate should set workflow as active', async () => {
test('POST /workflows/:id/activate should set workflow as active', async () => {
const member = await testDb.createUser({ globalRole: globalMemberRole, apiKey: randomApiKey() });
const authAgent = utils.createAgent(app, {
@ -692,7 +695,7 @@ test.skip('POST /workflows/:id/activate should set workflow as active', async ()
expect(await workflowRunner.isActive(workflow.id.toString())).toBe(true);
});
test.skip('POST /workflows/:id/activate should set non-owned workflow as active when owner', async () => {
test('POST /workflows/:id/activate should set non-owned workflow as active when owner', async () => {
const owner = await testDb.createUser({ globalRole: globalOwnerRole, apiKey: randomApiKey() });
const member = await testDb.createUser({ globalRole: globalMemberRole });