aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/api/static/announcements.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/api/static/announcements.spec.ts')
-rw-r--r--tests/functional/api/static/announcements.spec.ts55
1 files changed, 55 insertions, 0 deletions
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});