Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbyul-here committed Sep 25, 2024
1 parent 9356b87 commit 3bbd537
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import '@testing-library/jest-dom';

import { render, screen, fireEvent } from '@testing-library/react';
import { COOKIE_CONSENT_KEY } from './utils';
import { CookieConsent } from './index';

describe('Cookie consent form should render with correct content.', () => {
Expand Down Expand Up @@ -37,7 +38,7 @@ describe('Cookie consent form should render with correct content.', () => {
const resultCookie = document.cookie;

expect(resultCookie).toBe(
'CookieConsent={"responded":false,"answer":false}'
`${COOKIE_CONSENT_KEY}={"responded":false,"answer":false}`
);
});

Expand All @@ -46,7 +47,7 @@ describe('Cookie consent form should render with correct content.', () => {
fireEvent.click(button);
const resultCookie = document.cookie;
expect(resultCookie).toBe(
'CookieConsent={"responded":true,"answer":false}'
`${COOKIE_CONSENT_KEY}={"responded":true,"answer":false}`
);
});

Expand All @@ -55,6 +56,8 @@ describe('Cookie consent form should render with correct content.', () => {
fireEvent.click(button);
const resultCookie = document.cookie;

expect(resultCookie).toBe('CookieConsent={"responded":true,"answer":true}');
expect(resultCookie).toBe(
`${COOKIE_CONSENT_KEY}={"responded":true,"answer":true}`
);
});
});

0 comments on commit 3bbd537

Please sign in to comment.