Skip to content

Commit 042d13e

Browse files
committed
fixed tests
1 parent 4ee6f5f commit 042d13e

11 files changed

Lines changed: 474 additions & 708 deletions

vis/test/component/list-base.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe("List entries component - special BASE tests", () => {
124124
);
125125
});
126126

127-
const area = container.querySelector("#list_area");
127+
const area = container.querySelector(".list_area");
128128
act(() => {
129129
ReactTestUtils.Simulate.click(area);
130130
});
@@ -150,7 +150,7 @@ describe("List entries component - special BASE tests", () => {
150150
);
151151
});
152152

153-
const area = container.querySelector("#list_area");
153+
const area = container.querySelector(".list_area");
154154
act(() => {
155155
ReactTestUtils.Simulate.mouseOver(area);
156156
});
@@ -184,7 +184,7 @@ describe("List entries component - special BASE tests", () => {
184184
);
185185
});
186186

187-
const area = container.querySelector("#list_area");
187+
const area = container.querySelector(".list_area");
188188
act(() => {
189189
ReactTestUtils.Simulate.mouseOut(area);
190190
});

vis/test/component/list.test.js

Lines changed: 2 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,9 @@ describe("List entries component", () => {
636636
});
637637

638638
describe("events", () => {
639-
it("triggers a correct title click action in local files", () => {
639+
it("triggers a correct title click action in pubmed", () => {
640640
const EXPECTED_PAYLOAD = [zoomIn().type];
641-
const storeObject = setup({ show: true }, { service: null });
641+
const storeObject = setup({ show: true }, { service: "pubmed" });
642642
const store = mockStore(storeObject);
643643

644644
act(() => {
@@ -662,84 +662,6 @@ describe("List entries component", () => {
662662
expect(actions.map((a) => a.type)).toEqual(EXPECTED_PAYLOAD);
663663
});
664664

665-
it("triggers a correct area click action in local files", () => {
666-
const EXPECTED_PAYLOAD = [zoomIn().type];
667-
const storeObject = setup({ show: true }, { service: null });
668-
const store = mockStore(storeObject);
669-
670-
act(() => {
671-
render(
672-
<Provider store={store}>
673-
<LocalizationProvider localization={localization}>
674-
<List />
675-
</LocalizationProvider>
676-
</Provider>,
677-
container
678-
);
679-
});
680-
681-
const area = container.querySelector("#list_area");
682-
act(() => {
683-
ReactTestUtils.Simulate.click(area);
684-
});
685-
686-
const actions = store.getActions();
687-
688-
expect(actions.map((a) => a.type)).toEqual(EXPECTED_PAYLOAD);
689-
});
690-
691-
it("triggers a correct area mouseover action in local files", () => {
692-
const EXPECTED_PAYLOAD = highlightArea(initialTestData[0]);
693-
const storeObject = setup({ show: true }, { service: null });
694-
const store = mockStore(storeObject);
695-
696-
act(() => {
697-
render(
698-
<Provider store={store}>
699-
<LocalizationProvider localization={localization}>
700-
<List />
701-
</LocalizationProvider>
702-
</Provider>,
703-
container
704-
);
705-
});
706-
707-
const area = container.querySelector("#list_area");
708-
act(() => {
709-
ReactTestUtils.Simulate.mouseOver(area);
710-
});
711-
712-
const actions = store.getActions();
713-
714-
expect(actions).toEqual([EXPECTED_PAYLOAD]);
715-
});
716-
717-
it("triggers a correct area mouseout action in local files", () => {
718-
const EXPECTED_PAYLOAD = highlightArea(null);
719-
const storeObject = setup({ show: true }, { service: null });
720-
const store = mockStore(storeObject);
721-
722-
act(() => {
723-
render(
724-
<Provider store={store}>
725-
<LocalizationProvider localization={localization}>
726-
<List />
727-
</LocalizationProvider>
728-
</Provider>,
729-
container
730-
);
731-
});
732-
733-
const area = container.querySelector("#list_area");
734-
act(() => {
735-
ReactTestUtils.Simulate.mouseOut(area);
736-
});
737-
738-
const actions = store.getActions();
739-
740-
expect(actions).toEqual([EXPECTED_PAYLOAD]);
741-
});
742-
743665
it("renders with data without title, authors and abstract", () => {
744666
const storeObject = setup(
745667
{

vis/test/component/listtoggle.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import configureStore from "redux-mock-store";
66

77
import { toggleList } from "../../js/actions";
88

9-
import ListToggle from "../../js/components/ListToggle";
9+
import ListToggle from "../../js/templates/ListToggle";
1010
import LocalizationProvider from "../../js/components/LocalizationProvider";
1111

1212
const mockStore = configureStore([]);
@@ -63,7 +63,7 @@ describe("List toggle component", () => {
6363
});
6464

6565
expect(container.querySelector("#show_hide_label").textContent).toContain(
66-
storeObject.localization.hide_list
66+
"Overview (42 documents)"
6767
);
6868
});
6969

@@ -81,7 +81,7 @@ describe("List toggle component", () => {
8181
});
8282

8383
expect(container.querySelector("#show_hide_label").textContent).toContain(
84-
storeObject.localization.show_list
84+
"Overview (42 documents)"
8585
);
8686
});
8787

vis/test/component/modals.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,9 @@ describe("Modals component", () => {
378378
// tbh I don't get it why the output is this and not ACM
379379
expect(
380380
document.querySelector("#copy-paper-citation").textContent.trim()
381-
).toBe("Doe, J. (2021). Test paper. https://example.com\n https://example.com");
381+
).toBe(
382+
"Doe, J. (2021). Test paper. https://example.com\n https://example.com"
383+
);
382384
});
383385

384386
it("copies the citation to clipboard when Copy is clicked", async () => {
@@ -439,7 +441,7 @@ describe("Modals component", () => {
439441
let outerPromise = null;
440442
beforeEach(() => {
441443
innerPromise = Promise.resolve("some BibTex");
442-
outerPromise = Promise.resolve({ text: () => innerPromise });
444+
outerPromise = Promise.resolve({ ok: true, text: () => innerPromise });
443445

444446
global.fetch = jest.fn(() => outerPromise);
445447
});

vis/test/snapshot/__snapshots__/contextline.test.js.snap

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ exports[`Context line component snapshot matches a covis snapshot 1`] = `
4040
<span
4141
className="context_moreinfo infolink"
4242
onClick={[Function]}
43-
/>
43+
>
44+
<i
45+
className="fas fa-info-circle"
46+
/>
47+
48+
</span>
4449
</span>
4550
</p>
4651
`;
@@ -93,7 +98,12 @@ exports[`Context line component snapshot matches a linkedcat authorview snapshot
9398
<span
9499
className="context_moreinfo infolink"
95100
onClick={[Function]}
96-
/>
101+
>
102+
<i
103+
className="fas fa-info-circle"
104+
/>
105+
106+
</span>
97107
</span>
98108
</p>
99109
`;
@@ -151,7 +161,12 @@ exports[`Context line component snapshot matches a linkedcat keywordview snapsho
151161
<span
152162
className="context_moreinfo infolink"
153163
onClick={[Function]}
154-
/>
164+
>
165+
<i
166+
className="fas fa-info-circle"
167+
/>
168+
169+
</span>
155170
</span>
156171
</p>
157172
`;
@@ -245,7 +260,12 @@ exports[`Context line component snapshot matches a project website (base low qua
245260
<span
246261
className="context_moreinfo infolink"
247262
onClick={[Function]}
248-
/>
263+
>
264+
<i
265+
className="fas fa-info-circle"
266+
/>
267+
268+
</span>
249269
</span>
250270
</p>
251271
`;
@@ -339,7 +359,12 @@ exports[`Context line component snapshot matches a project website (pubmed high
339359
<span
340360
className="context_moreinfo infolink"
341361
onClick={[Function]}
342-
/>
362+
>
363+
<i
364+
className="fas fa-info-circle"
365+
/>
366+
367+
</span>
343368
</span>
344369
</p>
345370
`;
@@ -405,7 +430,12 @@ exports[`Context line component snapshot matches a viper snapshot 1`] = `
405430
<span
406431
className="context_moreinfo infolink"
407432
onClick={[Function]}
408-
/>
433+
>
434+
<i
435+
className="fas fa-info-circle"
436+
/>
437+
438+
</span>
409439
</span>
410440
</p>
411441
`;

0 commit comments

Comments
 (0)