@evanp/activitypub-bot 0.13.0 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/package.json +2 -2
  2. package/.github/dependabot.yml +0 -11
  3. package/.github/workflows/main.yml +0 -34
  4. package/.github/workflows/tag.yml +0 -106
  5. package/.nvmrc +0 -1
  6. package/Dockerfile +0 -17
  7. package/docs/activitypub.bot.drawio +0 -110
  8. package/tests/activitydistributor.test.js +0 -606
  9. package/tests/activityhandler.test.js +0 -2276
  10. package/tests/activitypubclient.test.js +0 -210
  11. package/tests/actorstorage.test.js +0 -283
  12. package/tests/app.test.js +0 -17
  13. package/tests/authorizer.test.js +0 -301
  14. package/tests/bot.donothing.test.js +0 -30
  15. package/tests/bot.ok.test.js +0 -101
  16. package/tests/botcontext.test.js +0 -720
  17. package/tests/botdatastorage.test.js +0 -88
  18. package/tests/botfactory.provincebotfactory.test.js +0 -430
  19. package/tests/digester.test.js +0 -56
  20. package/tests/fixtures/bots.js +0 -27
  21. package/tests/fixtures/eventloggingbot.js +0 -57
  22. package/tests/fixtures/provincebotfactory.js +0 -53
  23. package/tests/httpsignature.test.js +0 -199
  24. package/tests/httpsignatureauthenticator.test.js +0 -463
  25. package/tests/index.test.js +0 -12
  26. package/tests/keystorage.test.js +0 -124
  27. package/tests/microsyntax.test.js +0 -123
  28. package/tests/objectcache.test.js +0 -133
  29. package/tests/objectstorage.test.js +0 -149
  30. package/tests/remotekeystorage.test.js +0 -78
  31. package/tests/routes.actor.test.js +0 -214
  32. package/tests/routes.collection.test.js +0 -310
  33. package/tests/routes.health.test.js +0 -41
  34. package/tests/routes.inbox.test.js +0 -216
  35. package/tests/routes.object.test.js +0 -525
  36. package/tests/routes.server.test.js +0 -69
  37. package/tests/routes.sharedinbox.test.js +0 -473
  38. package/tests/routes.webfinger.test.js +0 -68
  39. package/tests/urlformatter.test.js +0 -164
  40. package/tests/utils/digest.js +0 -7
  41. package/tests/utils/nock.js +0 -499
@@ -1,214 +0,0 @@
1
- import { describe, it } from 'node:test'
2
- import assert from 'node:assert'
3
- import { makeApp } from '../lib/app.js'
4
- import request from 'supertest'
5
- import bots from './fixtures/bots.js'
6
-
7
- describe('actor routes', async () => {
8
- const databaseUrl = 'sqlite::memory:'
9
- const origin = 'https://activitypubbot.test'
10
- const app = await makeApp(databaseUrl, origin, bots, 'silent')
11
-
12
- describe('GET /user/{botid}', async () => {
13
- let response = null
14
- it('should work without an error', async () => {
15
- response = await request(app).get('/user/ok')
16
- })
17
- it('should return 200 OK', async () => {
18
- assert.strictEqual(response.status, 200)
19
- })
20
- it('should return AS2', async () => {
21
- assert.strictEqual(response.type, 'application/activity+json')
22
- })
23
- it('should return an object', async () => {
24
- assert.strictEqual(typeof response.body, 'object')
25
- })
26
- it('should return an object with an id', async () => {
27
- assert.strictEqual(typeof response.body.id, 'string')
28
- })
29
- it('should return an object with an id matching the request', async () => {
30
- assert.strictEqual(response.body.id, origin + '/user/ok')
31
- })
32
- it('should return an object with a type', async () => {
33
- assert.strictEqual(typeof response.body.type, 'string')
34
- })
35
- it('should return an object with a type matching the request', async () => {
36
- assert.strictEqual(response.body.type, 'Service')
37
- })
38
- it('should return an object with a preferredUsername', async () => {
39
- assert.strictEqual(typeof response.body.preferredUsername, 'string')
40
- })
41
- it('should return an object with a preferredUsername matching the request', async () => {
42
- assert.strictEqual(response.body.preferredUsername, 'ok')
43
- })
44
- it('should return an object with an inbox', async () => {
45
- assert.strictEqual(typeof response.body.inbox, 'string')
46
- })
47
- it('should return an object with an outbox', async () => {
48
- assert.strictEqual(typeof response.body.outbox, 'string')
49
- })
50
- it('should return an object with a followers', async () => {
51
- assert.strictEqual(typeof response.body.followers, 'string')
52
- })
53
- it('should return an object with a following', async () => {
54
- assert.strictEqual(typeof response.body.following, 'string')
55
- })
56
- it('should return an object with a liked', async () => {
57
- assert.strictEqual(typeof response.body.liked, 'string')
58
- })
59
- it('should return an object with a to', async () => {
60
- assert.strictEqual(typeof response.body.to, 'string')
61
- })
62
- it('should return an object with a to matching the request', async () => {
63
- assert.strictEqual(response.body.to, 'as:Public')
64
- })
65
- it('should return an object with a summary', async () => {
66
- assert.strictEqual(typeof response.body.summary, 'string')
67
- })
68
- it('should return an object with a summary matching the request', async () => {
69
- assert.strictEqual(response.body.summary, 'A bot that says "OK" when mentioned.')
70
- })
71
- it('should return an object with a name', async () => {
72
- assert.strictEqual(typeof response.body.name, 'string')
73
- })
74
- it('should return an object with a name matching the request', async () => {
75
- assert.strictEqual(response.body.name, 'OK Bot')
76
- })
77
- it('should return an object with a publicKey', async () => {
78
- assert.strictEqual(typeof response.body.publicKey, 'object')
79
- assert.ok(response.body.publicKey)
80
- })
81
- it('should return an object with a publicKey matching the request', async () => {
82
- assert.strictEqual(response.body.publicKey.id, origin + '/user/ok/publickey')
83
- })
84
- it('should return an object with a publicKey with an owner matching the request', async () => {
85
- assert.strictEqual(response.body.publicKey.owner, origin + '/user/ok')
86
- })
87
- it('should return an object with a publicKey with a type', async () => {
88
- assert.strictEqual(response.body.publicKey.type, 'CryptographicKey')
89
- })
90
- it('should return an object with a publicKey with a to', async () => {
91
- assert.strictEqual(response.body.publicKey.to, 'as:Public')
92
- })
93
- it('should return an object with a publicKey with a publicKeyPem', async () => {
94
- assert.strictEqual(typeof response.body.publicKey.publicKeyPem, 'string')
95
- })
96
- it('publicKeyPem should be an RSA PKCS-8 key', async () => {
97
- assert.match(response.body.publicKey.publicKeyPem, /^-----BEGIN PUBLIC KEY-----\n/)
98
- assert.match(response.body.publicKey.publicKeyPem, /\n-----END PUBLIC KEY-----\n$/)
99
- })
100
- it('should include endpoints', async () => {
101
- assert.strictEqual(typeof response.body.endpoints, 'object')
102
- })
103
- it('should include a sharedInbox endpoint', async () => {
104
- assert.strictEqual(typeof response.body.endpoints.sharedInbox, 'string')
105
- })
106
- })
107
-
108
- describe('GET non-existent user', async () => {
109
- let response = null
110
- it('should work without an error', async () => {
111
- response = await request(app).get('/user/dne')
112
- })
113
- it('should return 404 Not Found', async () => {
114
- assert.strictEqual(response.status, 404)
115
- })
116
- it('should return Problem Details JSON', async () => {
117
- assert.strictEqual(response.type, 'application/problem+json')
118
- })
119
- it('should return an object', async () => {
120
- assert.strictEqual(typeof response.body, 'object')
121
- })
122
- it('should return an object with a type', async () => {
123
- assert.strictEqual(typeof response.body.type, 'string')
124
- })
125
- it('should return an object with an type matching the request', async () => {
126
- assert.strictEqual(response.body.type, 'about:blank')
127
- })
128
- it('should return an object with a title', async () => {
129
- assert.strictEqual(typeof response.body.title, 'string')
130
- })
131
- it('should return an object with a title matching the request', async () => {
132
- assert.strictEqual(response.body.title, 'Not Found')
133
- })
134
- it('should return an object with a status', async () => {
135
- assert.strictEqual(typeof response.body.status, 'number')
136
- })
137
- it('should return an object with a status matching the request', async () => {
138
- assert.strictEqual(response.body.status, 404)
139
- })
140
- it('should return an object with a detail', async () => {
141
- assert.strictEqual(typeof response.body.detail, 'string')
142
- })
143
- it('should return an object with a detail matching the request', async () => {
144
- assert.strictEqual(response.body.detail, 'User dne not found')
145
- })
146
- })
147
-
148
- describe('GET /user/{dne}/publickey', async () => {
149
- let response = null
150
- it('should work without an error', async () => {
151
- response = await request(app).get('/user/dne')
152
- })
153
- it('should return 404 Not Found', async () => {
154
- assert.strictEqual(response.status, 404)
155
- })
156
- it('should return Problem Details JSON', async () => {
157
- assert.strictEqual(response.type, 'application/problem+json')
158
- })
159
- it('should return the right object', async () => {
160
- assert.strictEqual(typeof response.body, 'object')
161
- assert.strictEqual(response.body.type, 'about:blank')
162
- assert.strictEqual(response.body.title, 'Not Found')
163
- assert.strictEqual(response.body.status, 404)
164
- assert.strictEqual(response.body.detail, 'User dne not found')
165
- })
166
- })
167
-
168
- describe('GET /user/{botid}/publickey', async () => {
169
- let response = null
170
- it('should work without an error', async () => {
171
- response = await request(app).get('/user/ok/publickey')
172
- })
173
- it('should return 200 OK', async () => {
174
- assert.strictEqual(response.status, 200)
175
- })
176
- it('should return AS2', async () => {
177
- assert.strictEqual(response.type, 'application/activity+json')
178
- })
179
- it('should return an object', async () => {
180
- assert.strictEqual(typeof response.body, 'object')
181
- })
182
- it('should return an object with an id', async () => {
183
- assert.strictEqual(typeof response.body.id, 'string')
184
- })
185
- it('should return an object with the requested public key id', async () => {
186
- assert.strictEqual(response.body.id, origin + '/user/ok/publickey')
187
- })
188
- it('should return an object with an owner', async () => {
189
- assert.strictEqual(typeof response.body.owner, 'string')
190
- })
191
- it('should return an object with the bot as owner', async () => {
192
- assert.strictEqual(response.body.owner, origin + '/user/ok')
193
- })
194
- it('should return an object with a publicKeyPem', async () => {
195
- assert.strictEqual(typeof response.body.publicKeyPem, 'string')
196
- })
197
- it('publicKeyPem should be an RSA PKCS-8 key', async () => {
198
- assert.match(response.body.publicKeyPem, /^-----BEGIN PUBLIC KEY-----\n/)
199
- assert.match(response.body.publicKeyPem, /\n-----END PUBLIC KEY-----\n$/)
200
- })
201
- it('should return an object with a type', async () => {
202
- assert.strictEqual(typeof response.body.type, 'string')
203
- })
204
- it('should return an object with a type matching the request', async () => {
205
- assert.strictEqual(response.body.type, 'CryptographicKey')
206
- })
207
- it('should return an object with a to', async () => {
208
- assert.strictEqual(typeof response.body.to, 'string')
209
- })
210
- it('should return an object with a to matching the request', async () => {
211
- assert.strictEqual(response.body.to, 'as:Public')
212
- })
213
- })
214
- })
@@ -1,310 +0,0 @@
1
- import { describe, it } from 'node:test'
2
- import assert from 'node:assert'
3
- import { makeApp } from '../lib/app.js'
4
- import request from 'supertest'
5
- import bots from './fixtures/bots.js'
6
- import as2 from '../lib/activitystreams.js'
7
- import { nanoid } from 'nanoid'
8
-
9
- describe('actor collection routes', async () => {
10
- const databaseUrl = 'sqlite::memory:'
11
- const origin = 'https://activitypubbot.test'
12
- const app = await makeApp(databaseUrl, origin, bots, 'silent')
13
-
14
- for (const coll of ['outbox', 'liked', 'followers', 'following']) {
15
- describe(`${coll} collection`, async () => {
16
- describe(`GET /user/{botid}/${coll}`, async () => {
17
- let response = null
18
- it('should work without an error', async () => {
19
- response = await request(app).get(`/user/ok/${coll}`)
20
- })
21
- it('should return 200 OK', async () => {
22
- assert.strictEqual(response.status, 200)
23
- })
24
- it('should return AS2', async () => {
25
- assert.strictEqual(response.type, 'application/activity+json')
26
- })
27
- it('should return an object', async () => {
28
- assert.strictEqual(typeof response.body, 'object')
29
- })
30
- it('should return an object with an id', async () => {
31
- assert.strictEqual(typeof response.body.id, 'string')
32
- })
33
- it('should return an object with an id matching the request', async () => {
34
- assert.strictEqual(response.body.id, origin + `/user/ok/${coll}`)
35
- })
36
- it('should return an object with a type', async () => {
37
- assert.strictEqual(typeof response.body.type, 'string')
38
- })
39
- it('should return an object with a type matching the request', async () => {
40
- assert.strictEqual(response.body.type, 'OrderedCollection')
41
- })
42
- it('should return an object with a totalItems', async () => {
43
- assert.strictEqual(typeof response.body.totalItems, 'number')
44
- })
45
- it('should return an object with attributedTo', async () => {
46
- assert.strictEqual(typeof response.body.attributedTo, 'string')
47
- })
48
- it('should return an object with attributedTo matching the bot', async () => {
49
- assert.strictEqual(response.body.attributedTo, origin + '/user/ok')
50
- })
51
- it('should return an object with a to', async () => {
52
- assert.strictEqual(typeof response.body.to, 'string')
53
- })
54
- it('should return an object with a to for the public', async () => {
55
- assert.strictEqual(response.body.to, 'as:Public')
56
- })
57
- it('should return an object with a summary', async () => {
58
- assert.strictEqual(typeof response.body.summaryMap, 'object')
59
- assert.strictEqual(typeof response.body.summaryMap.en, 'string')
60
- })
61
- it('should return an object with a first', async () => {
62
- assert.strictEqual(typeof response.body.first, 'string')
63
- })
64
- it('should return an object with a last', async () => {
65
- assert.strictEqual(typeof response.body.last, 'string')
66
- })
67
- it(`should return an object with a ${coll}Of to the actor`, async () => {
68
- assert.strictEqual(typeof response.body[coll + 'Of'], 'string')
69
- assert.strictEqual(response.body[coll + 'Of'], origin + '/user/ok')
70
- })
71
- })
72
- describe('GET collection for non-existent user', async () => {
73
- let response = null
74
- it('should work without an error', async () => {
75
- response = await request(app).get('/user/dne/' + coll)
76
- })
77
- it('should return 404 Not Found', async () => {
78
- assert.strictEqual(response.status, 404)
79
- })
80
- it('should return Problem Details JSON', async () => {
81
- assert.strictEqual(response.type, 'application/problem+json')
82
- })
83
- it('should return an object', async () => {
84
- assert.strictEqual(typeof response.body, 'object')
85
- })
86
- it('should return an object with a type', async () => {
87
- assert.strictEqual(typeof response.body.type, 'string')
88
- })
89
- it('should return an object with an type matching the request', async () => {
90
- assert.strictEqual(response.body.type, 'about:blank')
91
- })
92
- it('should return an object with a title', async () => {
93
- assert.strictEqual(typeof response.body.title, 'string')
94
- })
95
- it('should return an object with a title matching the request', async () => {
96
- assert.strictEqual(response.body.title, 'Not Found')
97
- })
98
- it('should return an object with a status', async () => {
99
- assert.strictEqual(typeof response.body.status, 'number')
100
- })
101
- it('should return an object with a status matching the request', async () => {
102
- assert.strictEqual(response.body.status, 404)
103
- })
104
- it('should return an object with a detail', async () => {
105
- assert.strictEqual(typeof response.body.detail, 'string')
106
- })
107
- it('should return an object with a detail matching the request', async () => {
108
- assert.strictEqual(response.body.detail, 'User dne not found')
109
- })
110
- })
111
- describe(`GET /user/{botid}/${coll}/1`, async () => {
112
- let response = null
113
- it('should work without an error', async () => {
114
- response = await request(app).get(`/user/ok/${coll}/1`)
115
- })
116
- it('should return 200 OK', async () => {
117
- assert.strictEqual(response.status, 200)
118
- })
119
- it('should return AS2', async () => {
120
- assert.strictEqual(response.type, 'application/activity+json')
121
- })
122
- it('should return an object', async () => {
123
- assert.strictEqual(typeof response.body, 'object')
124
- })
125
- it('should return an object with an id', async () => {
126
- assert.strictEqual(typeof response.body.id, 'string')
127
- })
128
- it('should return an object with an id matching the request', async () => {
129
- assert.strictEqual(response.body.id, origin + `/user/ok/${coll}/1`)
130
- })
131
- it('should return an object with a type', async () => {
132
- assert.strictEqual(typeof response.body.type, 'string')
133
- })
134
- it('should return an object with a type matching the request', async () => {
135
- assert.strictEqual(response.body.type, 'OrderedCollectionPage')
136
- })
137
- it('should return an object with attributedTo', async () => {
138
- assert.strictEqual(typeof response.body.attributedTo, 'string')
139
- })
140
- it('should return an object with attributedTo matching the bot', async () => {
141
- assert.strictEqual(response.body.attributedTo, origin + '/user/ok')
142
- })
143
- it('should return an object with a to', async () => {
144
- assert.strictEqual(typeof response.body.to, 'string')
145
- })
146
- it('should return an object with a to for the public', async () => {
147
- assert.strictEqual(response.body.to, 'as:Public')
148
- })
149
- it('should return an object with a summary', async () => {
150
- assert.strictEqual(typeof response.body.summaryMap, 'object')
151
- assert.strictEqual(typeof response.body.summaryMap.en, 'string')
152
- })
153
- it('should return an object with a partOf', async () => {
154
- assert.strictEqual(typeof response.body.partOf, 'string')
155
- })
156
- it('should return an object with a partOf matching the collection', async () => {
157
- assert.strictEqual(response.body.partOf, origin + `/user/ok/${coll}`)
158
- })
159
- })
160
- describe('GET collection page for non-existent user', async () => {
161
- let response = null
162
- it('should work without an error', async () => {
163
- response = await request(app).get('/user/dne/' + coll + '/1')
164
- })
165
- it('should return 404 Not Found', async () => {
166
- assert.strictEqual(response.status, 404)
167
- })
168
- it('should return Problem Details JSON', async () => {
169
- assert.strictEqual(response.type, 'application/problem+json')
170
- })
171
- it('should return an object', async () => {
172
- assert.strictEqual(typeof response.body, 'object')
173
- })
174
- it('should return an object with a type', async () => {
175
- assert.strictEqual(typeof response.body.type, 'string')
176
- })
177
- it('should return an object with an type matching the request', async () => {
178
- assert.strictEqual(response.body.type, 'about:blank')
179
- })
180
- it('should return an object with a title', async () => {
181
- assert.strictEqual(typeof response.body.title, 'string')
182
- })
183
- it('should return an object with a title matching the request', async () => {
184
- assert.strictEqual(response.body.title, 'Not Found')
185
- })
186
- it('should return an object with a status', async () => {
187
- assert.strictEqual(typeof response.body.status, 'number')
188
- })
189
- it('should return an object with a status matching the request', async () => {
190
- assert.strictEqual(response.body.status, 404)
191
- })
192
- it('should return an object with a detail', async () => {
193
- assert.strictEqual(typeof response.body.detail, 'string')
194
- })
195
- it('should return an object with a detail matching the request', async () => {
196
- assert.strictEqual(response.body.detail, 'User dne not found')
197
- })
198
- })
199
- describe('GET non-existent page for existent collection and existent user', async () => {
200
- let response = null
201
- it('should work without an error', async () => {
202
- response = await request(app).get('/user/ok/' + coll + '/99999999')
203
- })
204
- it('should return 404 Not Found', async () => {
205
- assert.strictEqual(response.status, 404)
206
- })
207
- it('should return Problem Details JSON', async () => {
208
- assert.strictEqual(response.type, 'application/problem+json')
209
- })
210
- it('should return an object', async () => {
211
- assert.strictEqual(typeof response.body, 'object')
212
- })
213
- it('should return an object with a type', async () => {
214
- assert.strictEqual(typeof response.body.type, 'string')
215
- })
216
- it('should return an object with an type matching the request', async () => {
217
- assert.strictEqual(response.body.type, 'about:blank')
218
- })
219
- it('should return an object with a title', async () => {
220
- assert.strictEqual(typeof response.body.title, 'string')
221
- })
222
- it('should return an object with a title matching the request', async () => {
223
- assert.strictEqual(response.body.title, 'Not Found')
224
- })
225
- it('should return an object with a status', async () => {
226
- assert.strictEqual(typeof response.body.status, 'number')
227
- })
228
- it('should return an object with a status matching the request', async () => {
229
- assert.strictEqual(response.body.status, 404)
230
- })
231
- it('should return an object with a detail', async () => {
232
- assert.strictEqual(typeof response.body.detail, 'string')
233
- })
234
- it('should return an object with a detail matching the request', async () => {
235
- assert.strictEqual(response.body.detail, 'No such page 99999999 for collection ' + coll + ' for user ok')
236
- })
237
- })
238
- })
239
- }
240
-
241
- describe('GET non-existent collection for existent user', async () => {
242
- let response = null
243
- it('should work without an error', async () => {
244
- response = await request(app).get('/user/ok/dne')
245
- })
246
- it('should return 404 Not Found', async () => {
247
- assert.strictEqual(response.status, 404)
248
- })
249
- it('should return Problem Details JSON', async () => {
250
- assert.strictEqual(response.type, 'application/problem+json')
251
- })
252
- it('should return an object', async () => {
253
- assert.strictEqual(typeof response.body, 'object')
254
- })
255
- it('should return an object with a type', async () => {
256
- assert.strictEqual(typeof response.body.type, 'string')
257
- })
258
- it('should return an object with an type matching the request', async () => {
259
- assert.strictEqual(response.body.type, 'about:blank')
260
- })
261
- it('should return an object with a title', async () => {
262
- assert.strictEqual(typeof response.body.title, 'string')
263
- })
264
- it('should return an object with a title matching the request', async () => {
265
- assert.strictEqual(response.body.title, 'Not Found')
266
- })
267
- it('should return an object with a status', async () => {
268
- assert.strictEqual(typeof response.body.status, 'number')
269
- })
270
- it('should return an object with a status matching the request', async () => {
271
- assert.strictEqual(response.body.status, 404)
272
- })
273
- it('should return an object with a detail', async () => {
274
- assert.strictEqual(typeof response.body.detail, 'string')
275
- })
276
- })
277
-
278
- describe('GET /user/{botid}/outbox/1 with contents', async () => {
279
- let response = null
280
- const username = 'test0'
281
- const actorStorage = app.locals.actorStorage
282
- const objectStorage = app.locals.objectStorage
283
- const formatter = app.locals.formatter
284
-
285
- for (let i = 0; i < 20; i++) {
286
- const activity = await as2.import({
287
- '@context': 'https://www.w3.org/ns/activitystreams',
288
- to: 'as:Public',
289
- actor: formatter.format({ username }),
290
- type: 'IntransitiveActivity',
291
- id: formatter.format({
292
- username,
293
- type: 'intransitiveactivity',
294
- nanoid: nanoid()
295
- }),
296
- summary: 'An intransitive activity by the test0 bot',
297
- published: (new Date()).toISOString()
298
- })
299
- await objectStorage.create(activity)
300
- await actorStorage.addToCollection(username, 'outbox', activity)
301
- }
302
-
303
- it('should work without an error', async () => {
304
- response = await request(app).get(`/user/${username}/outbox/1`)
305
- })
306
- it('should return 200 OK', async () => {
307
- assert.strictEqual(response.status, 200)
308
- })
309
- })
310
- })
@@ -1,41 +0,0 @@
1
- import { describe, it } from 'node:test'
2
- import assert from 'node:assert'
3
- import { makeApp } from '../lib/app.js'
4
- import request from 'supertest'
5
- import bots from './fixtures/bots.js'
6
-
7
- describe('health check routes', async () => {
8
- const databaseUrl = 'sqlite::memory:'
9
- const origin = 'https://activitypubbot.test'
10
- const app = await makeApp(databaseUrl, origin, bots, 'silent')
11
- describe('GET /livez', async () => {
12
- let response = null
13
- it('should work without an error', async () => {
14
- response = await request(app).get('/livez')
15
- })
16
- it('should return 200 OK', async () => {
17
- assert.strictEqual(response.status, 200)
18
- })
19
- it('should return plain text', async () => {
20
- assert.strictEqual(response.type, 'text/plain')
21
- })
22
- it('should return an OK flag', async () => {
23
- assert.strictEqual(response.text, 'OK')
24
- })
25
- })
26
- describe('GET /readyz', async () => {
27
- let response = null
28
- it('should work without an error', async () => {
29
- response = await request(app).get('/readyz')
30
- })
31
- it('should return 200 OK', async () => {
32
- assert.strictEqual(response.status, 200)
33
- })
34
- it('should return plain text', async () => {
35
- assert.strictEqual(response.type, 'text/plain')
36
- })
37
- it('should return an OK flag', async () => {
38
- assert.strictEqual(response.text, 'OK')
39
- })
40
- })
41
- })