@davidbolaji/termii-node
Version:
Node.js SDK for Termii API – send SMS, voice, OTP, and manage messaging with ease.
23 lines (22 loc) • 845 B
JavaScript
import { SearchService } from "../insights/SearchService";
describe("SearchService", () => {
let httpClient;
let service;
beforeEach(() => {
httpClient = { request: jest.fn() };
service = new SearchService(httpClient);
});
it("checks phone number DND status and network", async () => {
const payload = { phone_number: "2348012345678" };
const mockResponse = {
number: "2348012345678",
status: "Active",
network: "MTN Nigeria",
network_code: "62120",
};
httpClient.request.mockResolvedValue(mockResponse);
const result = await service.checkNumber(payload);
expect(httpClient.request).toHaveBeenCalledWith("/check/dnd", { method: "GET", params: payload });
expect(result).toEqual(mockResponse);
});
});