本文整理汇总了TypeScript中supertest.SuperTest.post方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SuperTest.post方法的具体用法?TypeScript SuperTest.post怎么用?TypeScript SuperTest.post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类supertest.SuperTest
的用法示例。
在下文中一共展示了SuperTest.post方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it(`should return ${tests.default.statusCode}`, async () => {
return supertest
.post(`${getUrlPrefix(currentSpaceId)}/api/spaces/v1/space/${selectSpaceId}/select`)
.auth(user.username, user.password)
.expect(tests.default.statusCode)
.then(tests.default.response);
});
示例2: async
}`, async () => {
await supertest
.post(`${getUrlPrefix(spaceId)}/api/saved_objects/_export`)
.auth(user.username, user.password)
.expect(tests.noTypeOrObjects.statusCode)
.then(tests.noTypeOrObjects.response);
});
示例3: it
it(`should return ${tests.unknownType.statusCode}`, async () => {
const data = createImportData(spaceId);
data.push({
type: 'wigwags',
id: '1',
attributes: {
title: 'Wigwags title',
},
});
await supertest
.post(`${getUrlPrefix(spaceId)}/api/saved_objects/_resolve_import_errors`)
.auth(user.username, user.password)
.field(
'overwrites',
JSON.stringify([
{
type: 'wigwags',
id: '1',
},
{
type: 'dashboard',
id: `${getIdPrefix(spaceId)}a01b2f57-fcfd-4864-b735-09e28f0d815e`,
},
])
)
.attach(
'file',
Buffer.from(data.map(obj => JSON.stringify(obj)).join('\n'), 'utf8'),
'export.ndjson'
)
.expect(tests.unknownType.statusCode)
.then(tests.unknownType.response);
});
示例4: it
it(tests.custom.description, async () => {
await supertest
.post(`${getUrlPrefix(spaceId)}/api/saved_objects/${tests.custom!.type}`)
.auth(user.username, user.password)
.send(tests.custom!.requestBody)
.expect(tests.custom!.statusCode)
.then(tests.custom!.response);
});
示例5: it
it(`should return ${tests.default.statusCode}`, async () => {
await supertest
.post(`${getUrlPrefix(spaceId)}/api/saved_objects/_bulk_create`)
.auth(user.username, user.password)
.send(createBulkRequests(spaceId))
.expect(tests.default.statusCode)
.then(tests.default.response);
});
示例6: it
it(`should return ${tests.default.statusCode}`, async () => {
const data = createImportData(spaceId);
await supertest
.post(`${getUrlPrefix(spaceId)}/api/saved_objects/_import`)
.auth(user.username, user.password)
.attach('file', Buffer.from(JSON.stringify(data), 'utf8'), 'export.ndjson')
.expect(tests.default.statusCode)
.then(tests.default.response);
});
示例7: it
it(`should return ${tests.alreadyExists.statusCode}`, async () => {
return supertest
.post(`${getUrlPrefix(spaceId)}/api/spaces/space`)
.auth(user.username, user.password)
.send({
name: 'space_1',
id: 'space_1',
color: '#ffffff',
description: 'a description',
})
.expect(tests.alreadyExists.statusCode)
.then(tests.alreadyExists.response);
});