本文整理汇总了TypeScript中models/notifications/data_sharing_notification.DataSharingNotification类的典型用法代码示例。如果您正苦于以下问题:TypeScript DataSharingNotification类的具体用法?TypeScript DataSharingNotification怎么用?TypeScript DataSharingNotification使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataSharingNotification类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should create a notification for data sharing if one does not exist", (done) => {
jasmine.Ajax.stubRequest("/go/api/data_sharing/settings/notification_auth", undefined, "GET").andReturn({
responseText: JSON.stringify({show_notification: true}),
status: 200,
responseHeaders: {
"Accept": "application/vnd.go.cd.v1+json",
"Content-Type": "application/vnd.go.cd.v1+json"
}
});
const successCallback = jasmine.createSpy().and.callFake(() => {
const notifications = JSON.parse(localStorage.getItem("system_notifications") as string);
expect(notifications.length).toBe(1);
expect(notifications[0].message).toBe("GoCD shares data so that it can be improved.");
expect(notifications[0].type).toBe("DataSharing_v18.8.0");
expect(notifications[0].link).toBe("/go/admin/data_sharing/settings");
expect(notifications[0].linkText).toBe("Learn more ...");
expect(notifications[0].read).toBe(false);
expect(notifications[0].id).not.toBeUndefined();
const request = jasmine.Ajax.requests.mostRecent();
expect(request.method).toBe("GET");
expect(request.url).toBe("/go/api/data_sharing/settings/notification_auth");
expect(request.requestHeaders.Accept).toContain("application/vnd.go.cd.v1+json");
done();
});
DataSharingNotification.createIfNotPresent().then(successCallback);
});