aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/api
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/api')
-rw-r--r--tests/functional/api/register.spec.ts0
-rw-r--r--tests/functional/api/static/announcements.spec.ts55
-rw-r--r--tests/functional/api/static/features.spec.ts29
-rw-r--r--tests/functional/api/static/news.spec.ts11
-rw-r--r--tests/functional/api/static/services.spec.ts11
5 files changed, 106 insertions, 0 deletions
diff --git a/tests/functional/api/register.spec.ts b/tests/functional/api/register.spec.ts
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/functional/api/register.spec.ts
diff --git a/tests/functional/api/static/announcements.spec.ts b/tests/functional/api/static/announcements.spec.ts
new file mode 100644
index 0000000..ac933fe
--- /dev/null
+++ b/tests/functional/api/static/announcements.spec.ts
@@ -0,0 +1,55 @@
1import { test } from '@japa/runner';
2import { apiVersion } from '../../../config';
3
4test.group('API / Static / News', () => {
5 test('returns a 404 response when the requested versions does not exist', async ({
6 client,
7 }) => {
8 const response = await client.get(`/${apiVersion}/announcements/illegal`);
9
10 response.assertStatus(404);
11 response.assertTextIncludes('No announcement found.');
12 });
13
14 test('returns a 200 response with default version file when specifying version as input', async ({
15 client,
16 }) => {
17 const response = await client.get(`/${apiVersion}/announcements/version`);
18
19 response.assertStatus(200);
20 response.assertBody({
21 main: {
22 headline: 'Example Announcement',
23 subHeadline: 'Configure your announcement here',
24 image: {
25 light: 'https://api.ferdium.org/assets/feature/light.png',
26 dark: 'https://api.ferdium.org/assets/feature/dark.png',
27 },
28 text: 'Long description here',
29 cta: {
30 label: 'Click here to do something',
31 href: '/settings/app',
32 analytics: {
33 category: 'announcements-main',
34 action: 'event',
35 label: 'This does not get used',
36 },
37 },
38 },
39 spotlight: {
40 title: 'Spotlight:',
41 subject: 'Show another feature',
42 text: 'Show another feature in the spotlight',
43 cta: {
44 label: 'Click here to do something',
45 href: '/settings/team',
46 analytics: {
47 category: 'announcements-spotlight',
48 action: 'event',
49 label: 'This does not get used',
50 },
51 },
52 },
53 });
54 });
55});
diff --git a/tests/functional/api/static/features.spec.ts b/tests/functional/api/static/features.spec.ts
new file mode 100644
index 0000000..1050fcf
--- /dev/null
+++ b/tests/functional/api/static/features.spec.ts
@@ -0,0 +1,29 @@
1import { test } from '@japa/runner';
2import { apiVersion } from '../../../config';
3
4const defaultResponse = {
5 isServiceProxyEnabled: true,
6 isWorkspaceEnabled: true,
7 isAnnouncementsEnabled: true,
8 isSettingsWSEnabled: false,
9 isMagicBarEnabled: true,
10 isTodosEnabled: true,
11};
12
13test.group('API / Static / Features', () => {
14 test('returns a 200 response with empty array', async ({ client }) => {
15 const response = await client.get(`/${apiVersion}/features`);
16
17 response.assertStatus(200);
18 response.assertBody(defaultResponse);
19 });
20
21 test('returns a 200 response with expected object when calling with :mode', async ({
22 client,
23 }) => {
24 const response = await client.get(`/${apiVersion}/features/random`);
25
26 response.assertStatus(200);
27 response.assertBody(defaultResponse);
28 });
29});
diff --git a/tests/functional/api/static/news.spec.ts b/tests/functional/api/static/news.spec.ts
new file mode 100644
index 0000000..8f3818f
--- /dev/null
+++ b/tests/functional/api/static/news.spec.ts
@@ -0,0 +1,11 @@
1import { test } from '@japa/runner';
2import { apiVersion } from '../../../config';
3
4test.group('API / Static / News', () => {
5 test('returns a 200 response with empty array', async ({ client }) => {
6 const response = await client.get(`/${apiVersion}/news`);
7
8 response.assertStatus(200);
9 response.assertBody([]);
10 });
11});
diff --git a/tests/functional/api/static/services.spec.ts b/tests/functional/api/static/services.spec.ts
new file mode 100644
index 0000000..55eef37
--- /dev/null
+++ b/tests/functional/api/static/services.spec.ts
@@ -0,0 +1,11 @@
1import { test } from '@japa/runner';
2import { apiVersion } from '../../../config';
3
4test.group('API / Static / Services', () => {
5 test('returns a 200 response with empty array', async ({ client }) => {
6 const response = await client.get(`/${apiVersion}/services`);
7
8 response.assertStatus(200);
9 response.assertBody([]);
10 });
11});