grounding.spec.js
663 Bytes
import { purchaseGoodsInfoUpdateBatchPrice } from "./grounding";
import mockRequest from "./request";
jest.mock("./request", () => jest.fn((data, method) => Promise.resolve({ data, method })));
describe("grounding api", () => {
beforeEach(() => {
mockRequest.mockClear();
});
it("submits selected purchase ids and price to the batch price endpoint", async () => {
const payload = { ids: [1, "2"], purchasePrice: 88.5 };
await purchaseGoodsInfoUpdateBatchPrice(payload);
expect(mockRequest).toHaveBeenCalledWith({
ids: [1, "2"],
purchasePrice: 88.5,
method: "dj.api.smartcarlife.purchaseGoodsInfo.updateBatchPrice",
}, "post");
});
});