backend: Add appearance preferences API tests and helper functions
This commit is contained in:
parent
9a8da3e6fe
commit
3c4b373861
@ -41,6 +41,7 @@
|
|||||||
"test:integration-recordings": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/api/recordings\" --ci --reporters=default --reporters=jest-junit",
|
"test:integration-recordings": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/api/recordings\" --ci --reporters=default --reporters=jest-junit",
|
||||||
"test:integration-webhooks": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/webhooks\" --ci --reporters=default --reporters=jest-junit",
|
"test:integration-webhooks": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/webhooks\" --ci --reporters=default --reporters=jest-junit",
|
||||||
"test:integration-security": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/api/security\" --ci --reporters=default --reporters=jest-junit",
|
"test:integration-security": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/api/security\" --ci --reporters=default --reporters=jest-junit",
|
||||||
|
"test:integration-global-preferences": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit --testPathPattern \"tests/integration/api/global-preferences\" --ci --reporters=default --reporters=jest-junit",
|
||||||
"lint:fix": "eslint src --fix",
|
"lint:fix": "eslint src --fix",
|
||||||
"format:code": "prettier --ignore-path .gitignore --write '**/*.{ts,js,json,md}'"
|
"format:code": "prettier --ignore-path .gitignore --write '**/*.{ts,js,json,md}'"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -306,6 +306,26 @@ export const disconnectFakeParticipants = async () => {
|
|||||||
await sleep('1s');
|
await sleep('1s');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const updateAppearancePreferences = async (preferences: any) => {
|
||||||
|
checkAppIsRunning();
|
||||||
|
const userCookie = await loginUserAsRole(UserRole.ADMIN);
|
||||||
|
const response = await request(app)
|
||||||
|
.put(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/preferences/appearance`)
|
||||||
|
.set('Cookie', userCookie)
|
||||||
|
.send(preferences);
|
||||||
|
return response;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getAppearancePreferences = async () => {
|
||||||
|
checkAppIsRunning();
|
||||||
|
const userCookie = await loginUserAsRole(UserRole.ADMIN);
|
||||||
|
const response = await request(app)
|
||||||
|
.get(`${INTERNAL_CONFIG.INTERNAL_API_BASE_PATH_V1}/preferences/appearance`)
|
||||||
|
.set('Cookie', userCookie)
|
||||||
|
.send();
|
||||||
|
return response;
|
||||||
|
};
|
||||||
|
|
||||||
export const updateWebbhookPreferences = async (preferences: WebhookPreferences) => {
|
export const updateWebbhookPreferences = async (preferences: WebhookPreferences) => {
|
||||||
checkAppIsRunning();
|
checkAppIsRunning();
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,22 @@
|
|||||||
|
import { beforeAll, describe, expect, it } from '@jest/globals';
|
||||||
|
import { startTestServer } from '../../../helpers/request-helpers.js';
|
||||||
|
import { getAppearancePreferences, updateAppearancePreferences } from '../../../helpers/request-helpers.js';
|
||||||
|
|
||||||
|
describe('Appearance API Tests', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
startTestServer();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Get Appearance Preferences', () => {
|
||||||
|
it('should return 402 status code as it is a PRO feature', async () => {
|
||||||
|
const response = await getAppearancePreferences();
|
||||||
|
expect(response.status).toBe(402);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('Update Appearance Preferences', () => {
|
||||||
|
it('should return 402 status code as it is a PRO feature', async () => {
|
||||||
|
const response = await updateAppearancePreferences({});
|
||||||
|
expect(response.status).toBe(402);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user