Skip to content

Commit

Permalink
fix(test): use undefined instead of null
Browse files Browse the repository at this point in the history
typeof null is not undefined
  • Loading branch information
azu committed Jun 21, 2015
1 parent 2bd9d78 commit 43db567
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Ch4_AdvancedPromises/test/notification-thenable-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ describe("notification-thenable", function () {
delete global.Notification;
});
context("when already allowed permission", function () {
before(function () {
beforeEach(function () {
MockNotification.permission = "granted";
});
after(function () {
afterEach(function () {
delete MockNotification.permission;
});
it("should return Notification", function () {
Expand All @@ -28,8 +28,8 @@ describe("notification-thenable", function () {
});
});
context("when doesn't support Notification", function () {
before(function () {
global.Notification = null;
beforeEach(function () {
global.Notification = undefined;
});
it("should catch error", function () {
var promise = Promise.resolve(notifyMessageAsThenable("message"));
Expand All @@ -40,12 +40,12 @@ describe("notification-thenable", function () {
});
});
context("when user allow permission", function () {
before(function () {
beforeEach(function () {
MockNotification.requestPermission = function (callback) {
callback("granted");
};
});
after(function () {
afterEach(function () {
delete MockNotification.permission;
delete MockNotification.requestPermission;
});
Expand All @@ -58,12 +58,12 @@ describe("notification-thenable", function () {
});

context("when user deny permission", function () {
before(function () {
beforeEach(function () {
MockNotification.requestPermission = function (callback) {
callback("denied");
};
});
after(function () {
afterEach(function () {
delete MockNotification.permission;
delete MockNotification.requestPermission;
});
Expand Down

0 comments on commit 43db567

Please sign in to comment.