From 6318b5e95d02c3727b9cac4a85998fda4191bc08 Mon Sep 17 00:00:00 2001 From: Louise Wang Date: Tue, 12 Apr 2022 17:06:34 +0200 Subject: [PATCH] fix: minor fix by review --- src/hooks/itemValidation.test.ts | 6 +++--- src/hooks/itemValidation.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hooks/itemValidation.test.ts b/src/hooks/itemValidation.test.ts index 8da2f655..b77c385d 100644 --- a/src/hooks/itemValidation.test.ts +++ b/src/hooks/itemValidation.test.ts @@ -1,6 +1,6 @@ /* eslint-disable import/no-extraneous-dependencies */ import nock from 'nock'; -import { List } from 'immutable'; +import { List, Map } from 'immutable'; import { StatusCodes } from 'http-status-codes'; import Cookies from 'js-cookie'; import { mockHook, setUpTest } from '../../test/utils'; @@ -167,10 +167,10 @@ describe('Item Validation Hooks', () => { const endpoints = [{ route, response }]; const { data } = await mockHook({ endpoints, hook, wrapper }); - expect(data as ItemValidationAndReview).toEqual(response); + expect(data as ItemValidationAndReview).toEqual(Map(response)); // verify cache keys - expect(queryClient.getQueryData(key)).toEqual(response); + expect(queryClient.getQueryData(key)).toEqual(Map(response)); }); it(`Unauthorized`, async () => { const endpoints = [ diff --git a/src/hooks/itemValidation.ts b/src/hooks/itemValidation.ts index 11b0f86c..b1afc7b2 100644 --- a/src/hooks/itemValidation.ts +++ b/src/hooks/itemValidation.ts @@ -1,5 +1,5 @@ import { useQuery } from 'react-query'; -import { List } from 'immutable'; +import { List, Map } from 'immutable'; import { QueryClientConfig, UUID } from '../types'; import * as Api from '../api'; import { @@ -52,7 +52,7 @@ export default (queryConfig: QueryClientConfig) => { queryKey: buildItemValidationAndReviewKey(itemId), queryFn: () => Api.getItemValidationAndReview(queryConfig, itemId).then( - (data) => data, + (data) => Map(data), ), ...defaultOptions, enabled: Boolean(itemId),