Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
import {
|
|
createTeamProject,
|
|
testDb,
|
|
mockInstance,
|
|
createActiveWorkflow,
|
|
} from '@n8n/backend-test-utils';
|
|
import type { User } from '@n8n/db';
|
|
|
|
import { Telemetry } from '@/telemetry';
|
|
|
|
import { createUser } from '../shared/db/users';
|
|
import * as utils from '../shared/utils/';
|
|
|
|
mockInstance(Telemetry);
|
|
|
|
let member: User;
|
|
|
|
const testServer = utils.setupTestServer({
|
|
endpointGroups: ['workflows'],
|
|
enabledFeatures: ['feat:sharing', 'feat:advancedPermissions'],
|
|
});
|
|
|
|
beforeAll(async () => {
|
|
member = await createUser({ role: { slug: 'global:member' } });
|
|
|
|
await utils.initNodeTypes();
|
|
});
|
|
|
|
beforeEach(async () => {
|
|
await testDb.truncate([
|
|
'WorkflowEntity',
|
|
'SharedWorkflow',
|
|
'WorkflowHistory',
|
|
'WorkflowPublishHistory',
|
|
]);
|
|
});
|
|
|
|
describe('PUT /:workflowId/transfer', () => {
|
|
// This tests does not mock the ActiveWorkflowManager, which helps catching
|
|
// possible deadlocks when using transactions wrong.
|
|
test('can transfer an active workflow', async () => {
|
|
//
|
|
// ARRANGE
|
|
//
|
|
const destinationProject = await createTeamProject('Team Project', member);
|
|
|
|
const workflow = await createActiveWorkflow({}, member);
|
|
|
|
//
|
|
// ACT
|
|
//
|
|
const response = await testServer
|
|
.authAgentFor(member)
|
|
.put(`/workflows/${workflow.id}/transfer`)
|
|
.send({ destinationProjectId: destinationProject.id })
|
|
.expect(200);
|
|
|
|
//
|
|
// ASSERT
|
|
//
|
|
expect(response.body).toEqual({});
|
|
});
|
|
});
|