mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
add tests for getAPNsFullUrlToUse
This commit is contained in:
@@ -178,6 +178,29 @@ describe("NotificationService", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('getAPNsFullUrlToUse', () => {
|
||||||
|
it('should return the production URL when NODE_ENV is set to "production"', () => {
|
||||||
|
process.env.NODE_ENV = 'production';
|
||||||
|
const deviceId = 'testDeviceId';
|
||||||
|
const result = NotificationService.getAPNsFullUrlToUse(deviceId);
|
||||||
|
expect(result).toBe(`https://api.push.apple.com/3/device/${deviceId}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the sandbox URL when NODE_ENV is not set to "production"', () => {
|
||||||
|
process.env.NODE_ENV = 'development';
|
||||||
|
const deviceId = 'testDeviceId';
|
||||||
|
const result = NotificationService.getAPNsFullUrlToUse(deviceId);
|
||||||
|
expect(result).toBe(`https://api.sandbox.push.apple.com/3/device/${deviceId}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should append the correct device ID to the URL', () => {
|
||||||
|
process.env.NODE_ENV = 'production';
|
||||||
|
const deviceId = 'device123';
|
||||||
|
const result = NotificationService.getAPNsFullUrlToUse(deviceId);
|
||||||
|
expect(result).toBe(`https://api.push.apple.com/3/device/${deviceId}`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("cancelNotification", () => {
|
describe("cancelNotification", () => {
|
||||||
it("stops notification from sending to given shuttle/stop ID", async () => {
|
it("stops notification from sending to given shuttle/stop ID", async () => {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user