-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaProblem.spec.ts
More file actions
43 lines (41 loc) · 921 Bytes
/
aProblem.spec.ts
File metadata and controls
43 lines (41 loc) · 921 Bytes
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
import { Context as ProblemDetailContext } from '@nrfcloud/problem-detail'
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import { aProblem } from './aProblem.ts'
void describe('aProblem()', () => {
void it('should return a problem response', () =>
assert.deepEqual(
aProblem({
title: `A Conflict!`,
status: 409,
}),
{
statusCode: 409,
headers: {
'content-type': 'application/problem+json',
// 'Cache-Control': 'public, max-age=60',
'Cache-Control': 'no-store',
},
body: JSON.stringify({
'@context': ProblemDetailContext,
title: `A Conflict!`,
status: 409,
}),
},
))
void it('can set cache control', () =>
assert.partialDeepStrictEqual(
aProblem(
{
title: `A Conflict!`,
status: 409,
},
60,
),
{
headers: {
'Cache-Control': 'public, max-age=60',
},
},
))
})