Peter Makowski has proposed merging ~petermakowski/maas-site-manager:1474-fetch-tokens-from-mock-api into ~jonesogolo/maas-site-manager:1474-fetch-tokens-from-mock-api.
Requested reviews: Jones Ogolo (jonesogolo) For more details, see: https://code.launchpad.net/~petermakowski/maas-site-manager/+git/site-manager/+merge/439179 -- Your team MAAS Committers is subscribed to branch ~petermakowski/maas-site-manager:1474-fetch-tokens-from-mock-api.
diff --git a/frontend/src/hooks/api.test.ts b/frontend/src/hooks/api.test.ts index d30b752..4968ff4 100644 --- a/frontend/src/hooks/api.test.ts +++ b/frontend/src/hooks/api.test.ts @@ -1,29 +1,29 @@ import { renderHook, waitFor } from "@testing-library/react"; +import { rest } from "msw"; +import { setupServer } from "msw/node"; import { useSitesQuery, useTokensQuery } from "./api"; import urls from "@/api/urls"; import { siteFactory, tokenFactory } from "@/mocks/factories"; import { createMockGetTokensResolver, createMockSitesResolver } from "@/mocks/resolvers"; -import { createMockGetServer } from "@/mocks/server"; import { Providers } from "@/test-utils"; const sitesData = siteFactory.buildList(2); const tokensData = tokenFactory.buildList(2); -const mockServer = createMockGetServer(urls.sites, createMockSitesResolver(sitesData)); -const mockTokenServer = createMockGetServer(urls.tokens, createMockGetTokensResolver(tokensData)); +const mockServer = setupServer( + rest.get(urls.sites, createMockSitesResolver(sitesData)), + rest.get(urls.tokens, createMockGetTokensResolver(tokensData)), +); beforeAll(() => { mockServer.listen(); - mockTokenServer.listen(); }); afterEach(() => { mockServer.resetHandlers(); - mockTokenServer.resetHandlers(); }); afterAll(() => { mockServer.close(); - mockTokenServer.close(); }); it("should return sites", async () => {
-- Mailing list: https://launchpad.net/~sts-sponsors Post to : sts-sponsors@lists.launchpad.net Unsubscribe : https://launchpad.net/~sts-sponsors More help : https://help.launchpad.net/ListHelp