本文整理汇总了TypeScript中helpers/api_request_builder.ApiResult.unwrap方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ApiResult.unwrap方法的具体用法?TypeScript ApiResult.unwrap怎么用?TypeScript ApiResult.unwrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers/api_request_builder.ApiResult
的用法示例。
在下文中一共展示了ApiResult.unwrap方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<any>) => {
const responseJSON = response.unwrap() as SuccessResponse<any>;
expect(responseJSON.body.object.id()).toEqual("cluster_1");
expect(responseJSON.body.object.pluginId()).toEqual("plugin_1");
expect(response.getEtag()).toEqual("some-etag");
done();
});
示例2: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<any>) => {
// @ts-ignore
const serverBackup = response.unwrap().body as ServerBackup;
expect(serverBackup.time.toISOString()).toBe(new Date("2019-02-28T06:46:57Z").toISOString());
expect(serverBackup.isInProgress()).toBe(true);
expect(serverBackup.username).toBe("admin");
expect(serverBackup.message).toBe("Backing up Config.");
done();
});
示例3: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<any>) => {
const responseJSON = response.unwrap() as SuccessResponse<any>;
expect(responseJSON.body).toEqual(userJSON);
done();
});
示例4: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<string>) => {
const responseJSON = response.unwrap() as SuccessResponse<any>;
expect(responseJSON.body.message).toEqual(`Secret Configuration ${secretConfig.id()} was deleted successfully!`);
expect(response.getEtag()).toEqual("some-etag");
});
示例5: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<any>) => {
const responseJSON = response.unwrap() as SuccessResponse<any>;
expect(responseJSON.body.object.description()).toEqual(accessToken.description());
expect(responseJSON.body.etag).toEqual("some-etag");
done();
});
示例6: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<ClusterProfiles>) => {
const responseJSON = response.unwrap() as SuccessResponse<ClusterProfiles>;
expect((responseJSON.body as ClusterProfiles)).toHaveLength(2);
done();
});
示例7: expect
const onResponse = jasmine.createSpy().and.callFake((response: ApiResult<User>) => {
const responseJSON = response.unwrap() as SuccessResponse<User>;
expect(responseJSON.body.loginName()).toEqual(userJSON.login_name);
done();
});