Skip to content

Commit 336b742

Browse files
committed
fix: coverall failed on domain
1 parent 8ba3785 commit 336b742

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/components/AppHeader/__tests__/AppHeader.spec.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ describe('<AppHeader/>', () => {
133133
writable: true,
134134
});
135135

136+
Object.defineProperty(document, 'domain', {
137+
value: 'example.com',
138+
writable: true,
139+
});
140+
136141
render(
137142
<BrowserRouter>
138143
<QueryParamProvider adapter={ReactRouter5Adapter}>

src/utils/storage.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import Cookies from 'js-cookie';
22

33
export const removeCookies = (...cookieNames: string[]) => {
4-
const domains = [`.${document.domain.split('.').slice(-2).join('.')}`, `.${document.domain}`];
4+
const currentDomain = document.domain ?? '';
5+
const domains = [`.${currentDomain.split('.').slice(-2).join('.')}`, `.${currentDomain}`];
56

67
let parentPath = window.location.pathname.split('/', 2)[1];
78
if (parentPath !== '') {

0 commit comments

Comments
 (0)