Skip to content

Commit

Permalink
Rename {create|update}Message to {create|update}Notification.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neal committed Apr 1, 2015
1 parent 0aeb710 commit 56c316c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions lib/pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ var Pin = module.exports = function (opts) {
this.duration = opts.duration;
}

if (opts && opts.createMessage) {
this.createMessage = opts.createMessage instanceof Notification ?
opts.createMessage : new Notification(opts.createMessage);
if (opts && opts.createNotification) {
this.createNotification = opts.createNotification instanceof Notification ?
opts.createNotification : new Notification(opts.createNotification);
}

if (opts && opts.updateMessage) {
if (!opts.updateMessage.time) {
throw new Error('`time` is required by updateMessage.');
if (opts && opts.updateNotification) {
if (!opts.updateNotification.time) {
throw new Error('`time` is required by updateNotification.');
}
this.updateMessage = opts.updateMessage instanceof Notification ?
opts.updateMessage : new Notification(opts.updateMessage);
this.updateNotification = opts.updateNotification instanceof Notification ?
opts.updateNotification : new Notification(opts.updateNotification);
}

if (opts && opts.layout) {
Expand Down
20 changes: 10 additions & 10 deletions test/pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ describe('Pin', function () {
done();
});

it('should throw if updateMessage time is not set', function (done) {
it('should throw if updateNotification time is not set', function (done) {
var pinData = {
time: new Date(),
layout: layout,
updateMessage: new Pin.Notification({
updateNotification: new Pin.Notification({
layout: {
type: 'genericReminder',
title: 'Title',
Expand All @@ -88,14 +88,14 @@ describe('Pin', function () {
title: 'Title',
tinyIcon: Pin.Icon.PIN
}),
createMessage: new Pin.Notification({
createNotification: new Pin.Notification({
layout: {
type: 'genericReminder',
title: 'Title',
tinyIcon: Pin.Icon.CALENDAR
}
}),
updateMessage: new Pin.Notification({
updateNotification: new Pin.Notification({
time: new Date(),
layout: {
type: 'genericReminder',
Expand Down Expand Up @@ -136,35 +136,35 @@ describe('Pin', function () {
done();
});

it('should convert createMessage to a Notification object', function (done) {
it('should convert createNotification to a Notification object', function (done) {
var pin = new Pin({
time: new Date(),
layout: new Pin.Layout({
type: 'genericPin',
title: 'Title',
tinyIcon: Pin.Icon.FOOTBALL
}),
createMessage: {
createNotification: {
layout: {
type: 'genericReminder',
title: 'Title',
tinyIcon: Pin.Icon.PIN
}
},
});
assert.ok(pin.createMessage instanceof Pin.Notification);
assert.ok(pin.createNotification instanceof Pin.Notification);
done();
});

it('should convert updateMessage to a Notification object', function (done) {
it('should convert updateNotification to a Notification object', function (done) {
var pin = new Pin({
time: new Date(),
layout: new Pin.Layout({
type: 'genericPin',
title: 'Title',
tinyIcon: Pin.Icon.SUN
}),
updateMessage: {
updateNotification: {
time: new Date(),
layout: {
type: 'genericReminder',
Expand All @@ -173,7 +173,7 @@ describe('Pin', function () {
}
},
});
assert.ok(pin.updateMessage instanceof Pin.Notification);
assert.ok(pin.updateNotification instanceof Pin.Notification);
done();
});

Expand Down

0 comments on commit 56c316c

Please sign in to comment.