Skip to content

Commit 0252409

Browse files
committed
add more test
1 parent 5fa3414 commit 0252409

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

test/unit/service.spec.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ describe("Test Service", () => {
411411
expect(await svc.prepareContextParams(params)).toEqual({ a: 5 });
412412
});
413413

414-
it("should return the context params", async () => {
414+
it("should return the modified params", async () => {
415415
svc.prepareContextParams = jest.fn(params => {
416416
return {
417417
...params,
@@ -428,6 +428,19 @@ describe("Test Service", () => {
428428
expect(svc.prepareContextParams).toBeCalledTimes(1);
429429
expect(svc.prepareContextParams).toBeCalledWith(params);
430430
});
431+
432+
it("should return the unwrapped params", async () => {
433+
svc.prepareContextParams = jest.fn(async params => params.input);
434+
435+
const params = {
436+
input: { a: 5 },
437+
};
438+
439+
expect(await svc.prepareContextParams(params)).toEqual({ a: 5 });
440+
441+
expect(svc.prepareContextParams).toBeCalledTimes(1);
442+
expect(svc.prepareContextParams).toBeCalledWith(params);
443+
});
431444
});
432445

433446
describe("Test 'createServiceResolvers'", () => {

0 commit comments

Comments
 (0)