All files / app/test restMock.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 287x 7x   7x         7x       10x                           7x  
import { rest } from "msw";
import { setupServer } from "msw/node";
 
process.env = {
  ...process.env,
  NEXT_PUBLIC_NOMINATIM_URL: "http://nominatim.test/",
};
 
const server = setupServer(
  rest.get(
    `${process.env.NEXT_PUBLIC_NOMINATIM_URL!}search`,
    (req, res, ctx) => {
      return res(
        ctx.json([
          {
            address: { city: "test city", country: "test country" },
            lon: 1.0,
            lat: 2.0,
            display_name: "test city, test county, test country",
            boundingbox: [1, 1, 1, 1],
          },
        ])
      );
    }
  )
);
export { rest, server };