本文整理汇总了TypeScript中models/cluster_profiles/spec/test_data.clusterProfileTestData函数的典型用法代码示例。如果您正苦于以下问题:TypeScript clusterProfileTestData函数的具体用法?TypeScript clusterProfileTestData怎么用?TypeScript clusterProfileTestData使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clusterProfileTestData函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should deserialize cluster profile", () => {
const clusterProfileJSON = clusterProfileTestData("cluster_1", "plugin_1");
const clusterProfile = ClusterProfile.fromJSON(clusterProfileJSON);
expect(clusterProfile.id()).toEqual("cluster_1");
expect(clusterProfile.pluginId()).toEqual("plugin_1");
expect(clusterProfile.properties().count()).toBe(2);
expect(clusterProfile.properties().valueFor("key_1")).toEqual("value_1");
expect(clusterProfile.properties().valueFor("key_2")).toEqual("value_2");
});
示例2: clusterProfileResponse
function clusterProfileResponse() {
return {
status: 200,
responseHeaders: {
"Content-Type": "application/vnd.go.cd.v1+json; charset=utf-8",
"ETag": "some-etag"
},
responseText: JSON.stringify(clusterProfileTestData("cluster_1", "plugin_1"))
};
}
示例3: it
it("should create a cluster profile", (done) => {
jasmine.Ajax.stubRequest(ALL_CLUSTER_PROFILES_PATH).andReturn(clusterProfileResponse());
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();
});
ClusterProfilesCRUD.create(new ClusterProfile(clusterProfileTestData("cluster_1", "plugin_1"))).then(onResponse);
const request = jasmine.Ajax.requests.mostRecent();
expect(request.url).toEqual(ALL_CLUSTER_PROFILES_PATH);
expect(request.method).toEqual("POST");
expect(request.requestHeaders.Accept).toEqual("application/vnd.go.cd.v1+json");
});