1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
import { test } from '@japa/runner';
import { apiVersion } from '../../../config';
test.group('API / Static / News', () => {
test('returns a 404 response when the requested versions does not exist', async ({
client,
}) => {
const response = await client.get(`/${apiVersion}/announcements/illegal`);
response.assertStatus(404);
response.assertTextIncludes('No announcement found.');
});
test('returns a 200 response with default version file when specifying version as input', async ({
client,
}) => {
const response = await client.get(`/${apiVersion}/announcements/version`);
response.assertStatus(200);
response.assertBody({
main: {
headline: 'Example Announcement',
subHeadline: 'Configure your announcement here',
image: {
light: 'https://api.ferdium.org/assets/feature/light.png',
dark: 'https://api.ferdium.org/assets/feature/dark.png',
},
text: 'Long description here',
cta: {
label: 'Click here to do something',
href: '/settings/app',
analytics: {
category: 'announcements-main',
action: 'event',
label: 'This does not get used',
},
},
},
spotlight: {
title: 'Spotlight:',
subject: 'Show another feature',
text: 'Show another feature in the spotlight',
cta: {
label: 'Click here to do something',
href: '/settings/team',
analytics: {
category: 'announcements-spotlight',
action: 'event',
label: 'This does not get used',
},
},
},
});
});
});
|