本文整理汇总了TypeScript中supertest.SuperTest类的典型用法代码示例。如果您正苦于以下问题:TypeScript SuperTest类的具体用法?TypeScript SuperTest怎么用?TypeScript SuperTest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SuperTest类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
} when deleting a non-space-aware doc`, async () => {
await supertest
.get(`${getUrlPrefix(spaceId)}/api/saved_objects/globaltype/${notSpaceAwareId}`)
.auth(user.username, user.password)
.expect(tests.notSpaceAware.statusCode)
.then(tests.notSpaceAware.response);
});
示例2: before
before(async () => {
await esArchiver.load('saved_objects/spaces');
// since we want to verify that we only delete the right things
// and can't include a config document with the correct id in the
// archive we read the settings to trigger an automatic upgrade
// in each space
await supertest
.get('/api/kibana/settings')
.auth(user.username, user.password)
.expect(200);
await supertest
.get('/s/space_1/api/kibana/settings')
.auth(user.username, user.password)
.expect(200);
});
示例3: 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);
});
示例4: it
it(`should return ${tests.exists.statusCode}`, async () => {
return supertest
.get(`${getUrlPrefix(spaceId)}/api/spaces/space`)
.auth(user.username, user.password)
.expect(tests.exists.statusCode)
.then(tests.exists.response);
});
示例5: it
it(`should return ${tests.reservedSpace.statusCode}`, async () => {
return supertest
.delete(`${getUrlPrefix(spaceId)}/api/spaces/space/default`)
.auth(user.username, user.password)
.expect(tests.reservedSpace.statusCode)
.then(tests.reservedSpace.response);
});
示例6: 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);
});
示例7: async
}`, async () => {
await supertest
.post(`${getUrlPrefix(spaceId)}/api/saved_objects/_export`)
.auth(user.username, user.password)
.expect(tests.noTypeOrObjects.statusCode)
.then(tests.noTypeOrObjects.response);
});
示例8: 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);
});
示例9: 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);
});
示例10: 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);
});