From 0ddb510e0e17773815256caa0a82d78f233407c5 Mon Sep 17 00:00:00 2001 From: Vyrtsev Mikhail Date: Sun, 30 Jun 2019 00:36:18 +0300 Subject: [PATCH] add constants mocking --- frontend/app/common/__mocks__/constants.ts | 7 +++++++ frontend/app/common/__mocks__/settings.ts | 20 ++++++++++++++++++++ frontend/app/testUtils/mockPostInfo.ts | 2 ++ 3 files changed, 29 insertions(+) create mode 100644 frontend/app/common/__mocks__/constants.ts create mode 100644 frontend/app/common/__mocks__/settings.ts create mode 100644 frontend/app/testUtils/mockPostInfo.ts diff --git a/frontend/app/common/__mocks__/constants.ts b/frontend/app/common/__mocks__/constants.ts new file mode 100644 index 00000000..3fb7aef8 --- /dev/null +++ b/frontend/app/common/__mocks__/constants.ts @@ -0,0 +1,7 @@ +// @ts-ignore +const mock: typeof import('@app/common/constants') = { + ...jest.requireActual('@app/common/constants'), + BASE_URL: 'https://demo.remark42.com/', +}; + +module.exports = mock; diff --git a/frontend/app/common/__mocks__/settings.ts b/frontend/app/common/__mocks__/settings.ts new file mode 100644 index 00000000..adcb398c --- /dev/null +++ b/frontend/app/common/__mocks__/settings.ts @@ -0,0 +1,20 @@ +// @ts-ignore +const mock: typeof import('@app/common/settings') = { + ...jest.requireActual('@app/common/settings'), + siteId: 'remark', + pageTitle: 'remark test', + url: 'https://remark42.com/test', + maxShownComments: 20, + token: 'abcd', + theme: 'light', + querySettings: { + site_id: 'remark', + page_title: 'remark test', + url: 'https://remark42.com/test', + max_shown_comments: 20, + token: 'abcd', + theme: 'light', + }, +}; + +module.exports = mock; diff --git a/frontend/app/testUtils/mockPostInfo.ts b/frontend/app/testUtils/mockPostInfo.ts new file mode 100644 index 00000000..4d32cd9e --- /dev/null +++ b/frontend/app/testUtils/mockPostInfo.ts @@ -0,0 +1,2 @@ +jest.mock('@app/common/settings'); +jest.mock('@app/common/constants');