diff --git a/packages/react-network/src/test/hooks.test.tsx b/packages/react-network/src/test/hooks.test.tsx
index 61c882d06d..4314439c25 100644
--- a/packages/react-network/src/test/hooks.test.tsx
+++ b/packages/react-network/src/test/hooks.test.tsx
@@ -4,7 +4,7 @@ import {Header} from '@shopify/network';
import {FirstArgument} from '@shopify/useful-types';
import {NetworkManager} from '../manager';
import {NetworkContext} from '../context';
-import {useCookie, useAcceptLanguage} from '../hooks';
+import {useAcceptLanguage} from '../hooks';
describe('hooks', () => {
describe('useAcceptLanguage()', () => {
@@ -48,50 +48,6 @@ describe('hooks', () => {
expect(wrapper).toContainReactText('en');
});
});
-
- describe('useCookie', () => {
- function MockComponent({cookie}: {cookie: string}) {
- const [value, setCookie] = useCookie(cookie);
-
- return (
- <>
-
- {value}
- >
- );
- }
-
- it('gets a cookie', async () => {
- const key = 'foo';
- const value = 'bar';
- const cookies = {[key]: value};
-
- const wrapper = await mount(, {
- manager: new NetworkManager({cookies}),
- });
-
- expect(wrapper).toContainReactText(value);
- });
-
- it('sets a cookie', async () => {
- const key = 'foo';
- const value = 'bar';
- const cookies = {[key]: value};
-
- const wrapper = await mount(, {
- manager: new NetworkManager({cookies}),
- });
-
- wrapper
- .find(MockComponent)!
- .find('button')!
- .trigger('onClick');
-
- expect(wrapper).toContainReactText(`baz`);
- });
- });
});
const mount = createMount<{language?: string}>({
diff --git a/packages/react-network/src/test/manager.test.ts b/packages/react-network/src/test/manager.test.ts
index 52ba7d20be..723218054e 100644
--- a/packages/react-network/src/test/manager.test.ts
+++ b/packages/react-network/src/test/manager.test.ts
@@ -43,7 +43,7 @@ describe('NetworkManager', () => {
expect(manager.getCookie('foo')).toBeUndefined();
});
- it('sets initial cookies when coming the request as a string', () => {
+ it('sets initial cookies when set as a string', () => {
const manager = new NetworkManager({cookies: 'foo=bar'});
expect(manager.getCookie('foo')).toBe('bar');
diff --git a/packages/react-network/src/test/useCookie.test.tsx b/packages/react-network/src/test/useCookie.test.tsx
new file mode 100644
index 0000000000..9dddf694d7
--- /dev/null
+++ b/packages/react-network/src/test/useCookie.test.tsx
@@ -0,0 +1,61 @@
+import React from 'react';
+import {createMount} from '@shopify/react-testing';
+import {NetworkManager} from '../manager';
+import {NetworkContext} from '../context';
+import {useCookie} from '../hooks';
+
+describe('hooks', () => {
+ describe('useCookie', () => {
+ function MockComponent({cookie}: {cookie: string}) {
+ const [value, setCookie] = useCookie(cookie);
+
+ return (
+ <>
+
+ {value}
+ >
+ );
+ }
+
+ it('gets a cookie', async () => {
+ const key = 'foo';
+ const value = 'bar';
+ const cookies = {[key]: value};
+
+ const wrapper = await mount(, {
+ manager: new NetworkManager({cookies}),
+ });
+
+ expect(wrapper).toContainReactText(value);
+ });
+
+ it('sets a cookie', async () => {
+ const key = 'foo';
+ const value = 'bar';
+ const cookies = {[key]: value};
+
+ const wrapper = await mount(, {
+ manager: new NetworkManager({cookies}),
+ });
+
+ wrapper
+ .find(MockComponent)!
+ .find('button')!
+ .trigger('onClick');
+
+ expect(wrapper).toContainReactText(`baz`);
+ });
+ });
+});
+
+const mount = createMount<{manager?: NetworkManager}>({
+ render: (element, _, {manager = new NetworkManager()}) => {
+ return (
+
+ {element}
+
+ );
+ },
+});