mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
add sample key and mock fs return value
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
import { beforeEach, describe, expect, it } from "@jest/globals";
|
||||
import { beforeEach, describe, expect, it, jest } from "@jest/globals";
|
||||
import { NotificationService } from "../../src/services/NotificationService";
|
||||
import { UnoptimizedInMemoryRepository } from "../../src/repositories/UnoptimizedInMemoryRepository";
|
||||
import fs from "fs";
|
||||
|
||||
jest.mock("fs");
|
||||
|
||||
const sampleKey = `-----BEGIN PRIVATE KEY-----
|
||||
9EKORECHU09 eouEUHKCREOFA12409kOHKOEU9125ADABOU098AOEBAOEI15bhao
|
||||
XAOECR15bAAOECxrU91bAOEIAOERix145AOERDIIAOUX15997124xARODEARi119
|
||||
7k5AOEX151509KBRACOUDIAURCL1IAEO91245bAOECHDUAOE90kAOEB15139KAOA
|
||||
19ax15qu
|
||||
-----END PRIVATE KEY-----`
|
||||
|
||||
describe("NotificationService", () => {
|
||||
let repository: UnoptimizedInMemoryRepository
|
||||
@@ -16,7 +26,9 @@ describe("NotificationService", () => {
|
||||
APNS_KEY_ID: "1",
|
||||
APNS_TEAM_ID: "1",
|
||||
APNS_KEY_PATH: "./dummy-path.p8"
|
||||
}
|
||||
};
|
||||
|
||||
(fs.readFileSync as jest.Mock).mockReturnValue(sampleKey);
|
||||
})
|
||||
|
||||
describe("reloadAPNsTokenIfTimePassed", () => {
|
||||
|
||||
Reference in New Issue
Block a user