diff --git a/backend/package.json b/backend/package.json index 41c8581..ff4d3d8 100644 --- a/backend/package.json +++ b/backend/package.json @@ -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-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-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", "format:code": "prettier --ignore-path .gitignore --write '**/*.{ts,js,json,md}'" }, diff --git a/backend/tests/helpers/request-helpers.ts b/backend/tests/helpers/request-helpers.ts index 93b4299..e53f32f 100644 --- a/backend/tests/helpers/request-helpers.ts +++ b/backend/tests/helpers/request-helpers.ts @@ -306,6 +306,26 @@ export const disconnectFakeParticipants = async () => { 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) => { checkAppIsRunning(); diff --git a/backend/tests/integration/api/global-preferences/appearance.test.ts b/backend/tests/integration/api/global-preferences/appearance.test.ts new file mode 100644 index 0000000..c51dc2c --- /dev/null +++ b/backend/tests/integration/api/global-preferences/appearance.test.ts @@ -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); + }); + }); +});