forked from parse-community/node-apn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.js
More file actions
28 lines (24 loc) · 822 Bytes
/
Copy pathclient.js
File metadata and controls
28 lines (24 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module.exports = function () {
// Mocks of public API methods
function Client() {}
Client.prototype.write = function mockWrite(notification, device, type, method = 'post') {
return { device };
};
Client.prototype.setLogger = function mockSetLogger(newLogger, newErrorLogger = null) {
// Validate arguments but don't store the logger
if (typeof newLogger !== 'function') {
throw new Error(`Expected newLogger to be a function, got ${typeof newLogger}`);
}
if (newErrorLogger && typeof newErrorLogger !== 'function') {
throw new Error(
`Expected newErrorLogger to be a function or null, got ${typeof newErrorLogger}`
);
}
};
Client.prototype.shutdown = function mockShutdown(callback) {
if (callback) {
callback();
}
};
return Client;
};