* add timeout = 60s for uploading to private bucket * add debug logs * send response to client to close connection * add tests for upload * add PUBSUB_VERIFICATION_TOKEN in .env.test
24 lines
579 B
TypeScript
24 lines
579 B
TypeScript
import { request } from '../util'
|
|
import 'mocha'
|
|
|
|
describe('Pages Router', () => {
|
|
const token = process.env.PUBSUB_VERIFICATION_TOKEN || ''
|
|
|
|
describe('upload', () => {
|
|
it('upload data to GCS', async () => {
|
|
const data = {
|
|
message: {
|
|
data: Buffer.from(JSON.stringify({ userId: 'userId' })).toString(
|
|
'base64'
|
|
),
|
|
publishTime: new Date().toISOString(),
|
|
},
|
|
}
|
|
await request
|
|
.post(`/svc/pubsub/pages/upload/createdPage?token=${token}`)
|
|
.send(data)
|
|
.expect(200)
|
|
})
|
|
})
|
|
})
|