UNPKG

@davidbolaji/termii-node

Version:

Node.js SDK for Termii API – send SMS, voice, OTP, and manage messaging with ease.

34 lines (33 loc) 1.38 kB
import { StatusService } from "../insights/StatusResponseService"; describe("StatusService", () => { let httpClient; let service; beforeEach(() => { httpClient = { request: jest.fn() }; service = new StatusService(httpClient); }); it("checks number status with query params", async () => { const payload = { phone_number: "2348012345678", country_code: "NG" }; const mockResponse = { result: [ { routeDetail: { number: "2348012345678", ported: 0 }, countryDetail: { countryCode: "234", mobileCountryCode: "621", iso: "NG" }, operatorDetail: { operatorCode: "ANG", operatorName: "Airtel Nigeria", mobileNumberCode: "62120", mobileRoutingCode: "0001", carrierIdentificationCode: "001", lineType: "Mobile" }, status: 1 } ] }; httpClient.request.mockResolvedValue(mockResponse); const result = await service.checkStatus(payload); expect(httpClient.request).toHaveBeenCalledWith("/insight/number/query", { method: "GET", params: payload }); expect(result).toEqual(mockResponse); }); });