fix(core): Make enterprise trial requests via the backend (no-changelog) (#9784)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-06-17 19:56:52 +02:00
committed by GitHub
parent f7d7404907
commit 876bcbb04c
5 changed files with 43 additions and 32 deletions

View File

@@ -1,3 +1,4 @@
import nock from 'nock';
import config from '@/config';
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
import type { User } from '@db/entities/User';
@@ -47,6 +48,20 @@ describe('GET /license', () => {
});
});
describe('POST /license/enterprise/request_trial', () => {
nock('https://enterprise.n8n.io').post('/enterprise-trial').reply(200);
test('should work for instance owner', async () => {
await authOwnerAgent.post('/license/enterprise/request_trial').expect(200);
});
test('does not work for regular users', async () => {
await authMemberAgent
.post('/license/enterprise/request_trial')
.expect(403, { status: 'error', message: RESPONSE_ERROR_MESSAGES.MISSING_SCOPE });
});
});
describe('POST /license/activate', () => {
test('should work for instance owner', async () => {
await authOwnerAgent