Skip to content

Commit 279c64e

Browse files
committed
Merge pull request #237 from ToothlessGear/v1-remove-deprecations
V1 remove deprecations
2 parents a242ed0 + 3e41256 commit 279c64e

File tree

6 files changed

+3
-158
lines changed

6 files changed

+3
-158
lines changed

lib/constants.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,6 @@ var Constants = {
88

99
/** DEPRECATED **/
1010

11-
'TOKEN_MESSAGE_ID' : 'id',
12-
'TOKEN_CANONICAL_REG_ID' : 'registration_id',
13-
'TOKEN_ERROR' : 'Error',
14-
'JSON_REGISTRATION_IDS' : 'registration_ids',
15-
'JSON_PAYLOAD' : 'data',
16-
'JSON_NOTIFICATION' : 'notification',
17-
'JSON_SUCCESS' : 'success',
18-
'JSON_FAILURE' : 'failure',
19-
'JSON_CANONICAL_IDS' : 'canonical_ids',
20-
'JSON_MULTICAST_ID' : 'multicast_id',
21-
'JSON_RESULTS' : 'results',
22-
'JSON_ERROR' : 'error',
23-
'JSON_MESSAGE_ID' : 'message_id',
24-
'UTF8' : 'UTF-8',
25-
2611
//These errors could probably be structured more nicely, and could be used in the code.
2712
// -- maybe just as an Error abstraction?
2813
'ERROR_QUOTA_EXCEEDED' : 'QuotaExceeded',

lib/message.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,4 @@ Message.prototype.toJson = function() {
6363
return json;
6464
};
6565

66-
/** DEPRECATED */
67-
68-
Message.prototype.addDataWithKeyValue = function (key, value) {
69-
console.warn("Message#addDataWithKeyValue has been deprecated. Please use Message#addData instead.");
70-
this.addData(key, value);
71-
};
72-
73-
Message.prototype.addDataWithObject = function (obj) {
74-
console.warn("Message#addDataWithObject has been deprecated. Please use Message#addData instead.");
75-
this.addData(obj);
76-
};
77-
78-
/** END DEPRECATED */
79-
8066
module.exports = Message;

lib/multicastresult.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

lib/node-gcm.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
/*!
2-
* node-gcm
3-
* Copyright(c) 2013 Marcus Farkas <[email protected]>
4-
* MIT Licensed
5-
*/
6-
71
exports.Constants = require('./constants');
82
exports.Message = require('./message');
9-
exports.Result = require('./result');
10-
exports.MulitcastResult = require('./multicastresult');
113
exports.Sender = require('./sender');

lib/result.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

test/unit/messageSpec.js

Lines changed: 3 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -155,83 +155,6 @@ describe('UNIT Message', function () {
155155
it.skip('should do something if not called properly');
156156
});
157157

158-
describe('addDataWithKeyValue()', function () {
159-
it('should add properties to the message data object given a key and value', function () {
160-
var mess = new Message();
161-
mess.addDataWithKeyValue('myKey', 'Message');
162-
163-
var json = mess.toJson();
164-
165-
expect(json.data.myKey).to.equal('Message');
166-
});
167-
168-
it('should only set values on data object, not top level message', function () {
169-
var mess = new Message();
170-
mess.addDataWithKeyValue('collapseKey', 'Message');
171-
172-
var json = mess.toJson();
173-
174-
expect(json.collapse_key).to.not.equal('Message');
175-
expect(json.data.collapseKey).to.equal('Message');
176-
});
177-
178-
it.skip('should do something if not called properly');
179-
});
180-
181-
describe('addDataWithObject()', function () {
182-
it('should set the data property to the object passed in', function () {
183-
var mess = new Message();
184-
var obj = {
185-
message: 'hello',
186-
key: 'value'
187-
};
188-
mess.addDataWithObject(obj);
189-
190-
var json = mess.toJson();
191-
192-
expect(json.data).to.deep.equal(obj);
193-
});
194-
195-
it('should overwrite data object when an object is passed in', function () {
196-
var data = {
197-
message: 'hello',
198-
key: 'value'
199-
};
200-
var mess = new Message({ data: { message: 'bye', prop: 'none' } });
201-
mess.addDataWithObject(data);
202-
203-
var json = mess.toJson();
204-
205-
expect(json.data).to.deep.equal(data);
206-
});
207-
208-
it('should not overwrite data if not passed an object', function () {
209-
var data = {
210-
message: 'hello',
211-
key: 'value'
212-
};
213-
var mess = new Message({ data: data });
214-
mess.addDataWithObject('adding');
215-
216-
var json = mess.toJson();
217-
218-
expect(json.data).to.deep.equal(data);
219-
});
220-
221-
it('should not overwrite data if passed an empty object', function () {
222-
var data = {
223-
message: 'hello',
224-
key: 'value'
225-
};
226-
var mess = new Message({ data: data });
227-
mess.addDataWithObject({});
228-
229-
var json = mess.toJson();
230-
231-
expect(json.data).to.deep.equal(data);
232-
});
233-
});
234-
235158
describe('addNotification()', function () {
236159
it('should add attribute on notification object if pass key and value', function () {
237160
var mess = new Message();
@@ -260,7 +183,7 @@ describe('UNIT Message', function () {
260183
expect(json.notification).to.deep.equal(obj);
261184
});
262185
});
263-
186+
264187
describe('toJson()', function() {
265188
it('should return well-formed data for GCM if it is valid', function() {
266189
var m = new Message({
@@ -279,7 +202,7 @@ describe('UNIT Message', function () {
279202
expect(json.delayWhileIdle).to.be.an("undefined");
280203
expect(json.dryRun).to.be.an("undefined");
281204
});
282-
205+
283206
it('should return well-formed data for GCM if it describes a notification', function() {
284207
var notificationData = {
285208
title: "Hello, World",
@@ -296,7 +219,7 @@ describe('UNIT Message', function () {
296219
expect(json.notification).not.to.be.an("undefined");
297220
expect(json.notification).to.deep.equal(notificationData);
298221
});
299-
222+
300223
it('should ignore non-standard fields when serializing', function() {
301224
var m = new Message({
302225
timeToLive: 60 * 60 * 24,

0 commit comments

Comments
 (0)