Skip to content

Commit

Permalink
updates test to be more explicit with ckns_mvt
Browse files Browse the repository at this point in the history
  • Loading branch information
HarveyPeachey committed Oct 8, 2024
1 parent 98aaa6a commit 624087d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/contexts/UserContext/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ describe('UserContext', () => {

beforeEach(() => {
jest.clearAllMocks();
Cookie.remove('ckns_mvt');
});

it('should call cookie logic when not opera mini and is on client', () => {
Expand Down Expand Up @@ -104,11 +105,12 @@ describe('UserContext', () => {
it('should not set cookie when ckns_mvt cookie already exists', () => {
onClientSpy.mockImplementationOnce(() => true as unknown as Location);
isOperaProxySpy.mockImplementationOnce(() => false);
// @ts-expect-error This should be able to be mocked as a string or undefined
cookieGetterSpy.mockImplementationOnce(() => 'foo');
Cookie.set('ckns_mvt', 'foo');
cookieSetterSpy.mockClear();

render(<DummyComponentWithContext />);

expect(cookieGetterSpy).toHaveReturnedWith('foo');
expect(cookieSetterSpy).not.toHaveBeenCalled();
});

Expand Down

0 comments on commit 624087d

Please sign in to comment.