diff options
| author | Max Nanis | 2025-06-26 16:46:35 +0700 |
|---|---|---|
| committer | Max Nanis | 2025-06-26 16:46:35 +0700 |
| commit | 6043bd09c33cc89e39b2ad17ecc5f33eda67f10b (patch) | |
| tree | 3a8f18371829aeaef8639f85531196b4015e1de1 /tests/models/ProfileQuestion.test.tsx | |
| parent | 80539188ef6814b4202d677d62b761bd5b670574 (diff) | |
| download | panel-ui-6043bd09c33cc89e39b2ad17ecc5f33eda67f10b.tar.gz panel-ui-6043bd09c33cc89e39b2ad17ecc5f33eda67f10b.zip | |
Basic jest tests working for building on Jenkins
Diffstat (limited to 'tests/models/ProfileQuestion.test.tsx')
| -rw-r--r-- | tests/models/ProfileQuestion.test.tsx | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/tests/models/ProfileQuestion.test.tsx b/tests/models/ProfileQuestion.test.tsx new file mode 100644 index 0000000..cc825eb --- /dev/null +++ b/tests/models/ProfileQuestion.test.tsx @@ -0,0 +1,80 @@ +import {render, screen,} from '@testing-library/react'; +import {describe, it} from '@jest/globals'; +import {ProfileQuestionFull} from "@/pages/Questions" +import '@testing-library/jest-dom'; // needed for .toBeInTheDocument() +import {ProfileQuestion} from "@/models/questionSlice"; +import {Provider} from "react-redux"; +import {store} from "@/store"; +import {App} from "@/models/app"; +import {setApp} from "@/models/appSlice.ts"; +import '@testing-library/jest-dom'; + +const q: ProfileQuestion = { + "question_id": "0471eb56de8247cda7468e473bab87f2", + "ext_question_id": "rd:105019", + "question_type": "MC", + "country_iso": "us", + "language_iso": "eng", + "question_text": "Which of the following is your primary bank? ", + "choices": [ + { + "choice_id": "1", + "choice_text": "Ally Bank", + "order": 0, + "exclusive": false + }, + { + "choice_id": "2", + "choice_text": "Bank of America", + "order": 1, + "exclusive": false + }, + { + "choice_id": "27", + "choice_text": "BB&T", + "order": 2, + "exclusive": false + }, + ], + "selector": "SA", + "importance": { + "task_count": 3, + "task_score": 0.006180190564957855, + "marketplace_task_count": { + "rd": 3 + } + }, + "categories": [], + "task_count": 3, + "task_score": 0.006180190564957855, + "marketplace_task_count": { + "rd": 3 + }, + "active": true +} as ProfileQuestion + +// GRL Snippet configuration options +// const settings: App = { +// targetId: 'grl-widget', +// bpid: "invalid-bpid-from-snippet", +// bpuid: "invalid-bpuid-from-snippet", +// offerwall: "37d1da64", +// walletMode: true, +// panelName: null, +// leaderboard: false, +// currentPage: "offerwall" +// } as App +// store.dispatch(setApp(settings)) + +describe('ProfileQuestionFull', () => { + + it('renders the correct title', () => { + render( + <Provider store={store}> + <ProfileQuestionFull question={q} submitAnswerEvt={() => {}}/> + </Provider> + ); + const element = screen.getByText(/Which of the following is your primary bank/i); + expect(element).toBeInTheDocument(); + }); +});
\ No newline at end of file |
