本文整理匯總了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");
});