From 4d794913e71f88d08adbc5f524d5b8ac7c29c19f Mon Sep 17 00:00:00 2001 From: "D. Ror." Date: Wed, 8 Jan 2025 13:04:21 -0500 Subject: [PATCH 1/2] Generalize AutocompleteSetting (#3488) --- Backend.Tests/Models/ProjectTests.cs | 2 +- Backend/Models/Project.cs | 8 ++++---- Backend/Models/User.cs | 4 ++-- src/api/.openapi-generator/FILES | 2 +- src/api/models/index.ts | 2 +- .../{autocomplete-setting.ts => off-on-setting.ts} | 2 +- src/api/models/project.ts | 6 +++--- src/api/models/user.ts | 14 +++++++------- src/components/DataEntry/DataEntryTable/index.tsx | 7 +++---- .../ProjectSettings/ProjectAutocomplete.tsx | 10 +++++----- .../tests/ProjectAutocomplete.test.tsx | 6 +++--- src/components/UserSettings/UserSettings.tsx | 8 ++++---- src/types/project.ts | 4 ++-- src/types/user.ts | 4 ++-- 14 files changed, 39 insertions(+), 40 deletions(-) rename src/api/models/{autocomplete-setting.ts => off-on-setting.ts} (93%) diff --git a/Backend.Tests/Models/ProjectTests.cs b/Backend.Tests/Models/ProjectTests.cs index 59e73a98fd..9985138e5e 100644 --- a/Backend.Tests/Models/ProjectTests.cs +++ b/Backend.Tests/Models/ProjectTests.cs @@ -107,7 +107,7 @@ public void TestClone() LiftImported = true, DefinitionsEnabled = true, GrammaticalInfoEnabled = true, - AutocompleteSetting = AutocompleteSetting.On, + AutocompleteSetting = OffOnSetting.On, SemDomWritingSystem = new("fr", "Français"), VernacularWritingSystem = new("en", "English", "Calibri"), AnalysisWritingSystems = new() { new("es", "Español") }, diff --git a/Backend/Models/Project.cs b/Backend/Models/Project.cs index ba6c3fe6f8..90e726b598 100644 --- a/Backend/Models/Project.cs +++ b/Backend/Models/Project.cs @@ -38,7 +38,7 @@ public class Project [Required] [BsonElement("autocompleteSetting")] [BsonRepresentation(BsonType.String)] - public AutocompleteSetting AutocompleteSetting { get; set; } + public OffOnSetting AutocompleteSetting { get; set; } [Required] [BsonElement("semDomWritingSystem")] @@ -92,7 +92,7 @@ public Project() LiftImported = false; DefinitionsEnabled = false; GrammaticalInfoEnabled = false; - AutocompleteSetting = AutocompleteSetting.On; + AutocompleteSetting = OffOnSetting.On; SemDomWritingSystem = new(); VernacularWritingSystem = new(); AnalysisWritingSystems = new(); @@ -186,10 +186,10 @@ public override int GetHashCode() var hash = new HashCode(); hash.Add(Id); hash.Add(Name); + hash.Add(IsActive); hash.Add(LiftImported); hash.Add(DefinitionsEnabled); hash.Add(GrammaticalInfoEnabled); - hash.Add(IsActive); hash.Add(AutocompleteSetting); hash.Add(SemDomWritingSystem); hash.Add(VernacularWritingSystem); @@ -329,7 +329,7 @@ public UserCreatedProject() } } - public enum AutocompleteSetting + public enum OffOnSetting { Off, On diff --git a/Backend/Models/User.cs b/Backend/Models/User.cs index d6407b1416..1814dd8758 100644 --- a/Backend/Models/User.cs +++ b/Backend/Models/User.cs @@ -72,7 +72,7 @@ public class User [Required] [BsonElement("glossSuggestion")] [BsonRepresentation(BsonType.String)] - public AutocompleteSetting GlossSuggestion { get; set; } + public OffOnSetting GlossSuggestion { get; set; } [Required] [BsonElement("token")] @@ -98,7 +98,7 @@ public User() Password = ""; Username = ""; UILang = ""; - GlossSuggestion = AutocompleteSetting.On; + GlossSuggestion = OffOnSetting.On; Token = ""; IsAdmin = false; WorkedProjects = new(); diff --git a/src/api/.openapi-generator/FILES b/src/api/.openapi-generator/FILES index 873eb5b3b5..cf9d132ea8 100644 --- a/src/api/.openapi-generator/FILES +++ b/src/api/.openapi-generator/FILES @@ -21,7 +21,6 @@ common.ts configuration.ts git_push.sh index.ts -models/autocomplete-setting.ts models/banner-type.ts models/chart-root-data.ts models/consent-type.ts @@ -42,6 +41,7 @@ models/merge-source-word.ts models/merge-undo-ids.ts models/merge-words.ts models/note.ts +models/off-on-setting.ts models/password-reset-data.ts models/password-reset-request-data.ts models/permission.ts diff --git a/src/api/models/index.ts b/src/api/models/index.ts index 5b140bd273..dc5992c9b2 100644 --- a/src/api/models/index.ts +++ b/src/api/models/index.ts @@ -1,4 +1,3 @@ -export * from "./autocomplete-setting"; export * from "./banner-type"; export * from "./chart-root-data"; export * from "./consent-type"; @@ -18,6 +17,7 @@ export * from "./merge-source-word"; export * from "./merge-undo-ids"; export * from "./merge-words"; export * from "./note"; +export * from "./off-on-setting"; export * from "./password-reset-data"; export * from "./password-reset-request-data"; export * from "./permission"; diff --git a/src/api/models/autocomplete-setting.ts b/src/api/models/off-on-setting.ts similarity index 93% rename from src/api/models/autocomplete-setting.ts rename to src/api/models/off-on-setting.ts index b54c9ab6fa..a41171e274 100644 --- a/src/api/models/autocomplete-setting.ts +++ b/src/api/models/off-on-setting.ts @@ -17,7 +17,7 @@ * @export * @enum {string} */ -export enum AutocompleteSetting { +export enum OffOnSetting { Off = "Off", On = "On", } diff --git a/src/api/models/project.ts b/src/api/models/project.ts index 0958b4d28c..04ed705511 100644 --- a/src/api/models/project.ts +++ b/src/api/models/project.ts @@ -12,9 +12,9 @@ * Do not edit the class manually. */ -import { AutocompleteSetting } from "./autocomplete-setting"; import { CustomField } from "./custom-field"; import { EmailInvite } from "./email-invite"; +import { OffOnSetting } from "./off-on-setting"; import { SemanticDomainFull } from "./semantic-domain-full"; import { WritingSystem } from "./writing-system"; @@ -62,10 +62,10 @@ export interface Project { grammaticalInfoEnabled: boolean; /** * - * @type {AutocompleteSetting} + * @type {OffOnSetting} * @memberof Project */ - autocompleteSetting: AutocompleteSetting; + autocompleteSetting: OffOnSetting; /** * * @type {WritingSystem} diff --git a/src/api/models/user.ts b/src/api/models/user.ts index fef3669aef..b88fa4d43a 100644 --- a/src/api/models/user.ts +++ b/src/api/models/user.ts @@ -12,7 +12,7 @@ * Do not edit the class manually. */ -import { AutocompleteSetting } from "./autocomplete-setting"; +import { OffOnSetting } from "./off-on-setting"; /** * @@ -100,20 +100,20 @@ export interface User { uiLang?: string | null; /** * - * @type {string} + * @type {OffOnSetting} * @memberof User */ - token: string; + glossSuggestion: OffOnSetting; /** * - * @type {boolean} + * @type {string} * @memberof User */ - isAdmin: boolean; + token: string; /** * - * @type {AutocompleteSetting} + * @type {boolean} * @memberof User */ - glossSuggestion: AutocompleteSetting; + isAdmin: boolean; } diff --git a/src/components/DataEntry/DataEntryTable/index.tsx b/src/components/DataEntry/DataEntryTable/index.tsx index ce9f8325cc..3d20bda5dd 100644 --- a/src/components/DataEntry/DataEntryTable/index.tsx +++ b/src/components/DataEntry/DataEntryTable/index.tsx @@ -17,8 +17,8 @@ import { useTranslation } from "react-i18next"; import { v4 } from "uuid"; import { - AutocompleteSetting, Note, + OffOnSetting, Pronunciation, SemanticDomain, SemanticDomainTreeNode, @@ -250,8 +250,7 @@ export default function DataEntryTable( ); const suggestVerns = useAppSelector( (state: StoreState) => - state.currentProjectState.project.autocompleteSetting === - AutocompleteSetting.On + state.currentProjectState.project.autocompleteSetting === OffOnSetting.On ); const vernacularLang = useAppSelector( (state: StoreState) => @@ -272,7 +271,7 @@ export default function DataEntryTable( const spellChecker = useContext(SpellCheckerContext); useEffect(() => { spellChecker.updateLang( - getCurrentUser()?.glossSuggestion === AutocompleteSetting.Off + getCurrentUser()?.glossSuggestion === OffOnSetting.Off ? undefined : analysisLang.bcp47 ); diff --git a/src/components/ProjectSettings/ProjectAutocomplete.tsx b/src/components/ProjectSettings/ProjectAutocomplete.tsx index 1c0f4c7402..5890af880f 100644 --- a/src/components/ProjectSettings/ProjectAutocomplete.tsx +++ b/src/components/ProjectSettings/ProjectAutocomplete.tsx @@ -3,7 +3,7 @@ import { Grid, MenuItem, Select, Tooltip } from "@mui/material"; import { type ReactElement } from "react"; import { useTranslation } from "react-i18next"; -import { AutocompleteSetting } from "api/models"; +import { OffOnSetting } from "api/models"; import { type ProjectSettingProps } from "components/ProjectSettings/ProjectSettingsTypes"; export default function ProjectAutocomplete( @@ -12,7 +12,7 @@ export default function ProjectAutocomplete( const { t } = useTranslation(); const updateAutocompleteSetting = async ( - autocompleteSetting: AutocompleteSetting + autocompleteSetting: OffOnSetting ): Promise => { await props.setProject({ ...props.project, autocompleteSetting }); }; @@ -24,13 +24,13 @@ export default function ProjectAutocomplete( variant="standard" value={props.project.autocompleteSetting} onChange={(e) => - updateAutocompleteSetting(e.target.value as AutocompleteSetting) + updateAutocompleteSetting(e.target.value as OffOnSetting) } > - + {t("projectSettings.autocomplete.off")} - + {t("projectSettings.autocomplete.on")} diff --git a/src/components/ProjectSettings/tests/ProjectAutocomplete.test.tsx b/src/components/ProjectSettings/tests/ProjectAutocomplete.test.tsx index 5b3b179158..0647cd33f4 100644 --- a/src/components/ProjectSettings/tests/ProjectAutocomplete.test.tsx +++ b/src/components/ProjectSettings/tests/ProjectAutocomplete.test.tsx @@ -1,7 +1,7 @@ import { Select } from "@mui/material"; import renderer from "react-test-renderer"; -import { AutocompleteSetting } from "api/models"; +import { OffOnSetting } from "api/models"; import ProjectAutocomplete from "components/ProjectSettings/ProjectAutocomplete"; import { randomProject } from "types/project"; @@ -26,12 +26,12 @@ describe("ProjectAutocomplete", () => { await renderer.act(async () => selectChange({ target: { value: "Off" } })); expect(mockSetProject).toHaveBeenCalledWith({ ...mockProject, - autocompleteSetting: AutocompleteSetting.Off, + autocompleteSetting: OffOnSetting.Off, }); await renderer.act(async () => selectChange({ target: { value: "On" } })); expect(mockSetProject).toHaveBeenCalledWith({ ...mockProject, - autocompleteSetting: AutocompleteSetting.On, + autocompleteSetting: OffOnSetting.On, }); }); }); diff --git a/src/components/UserSettings/UserSettings.tsx b/src/components/UserSettings/UserSettings.tsx index ecf98a692c..8d6f69e0f5 100644 --- a/src/components/UserSettings/UserSettings.tsx +++ b/src/components/UserSettings/UserSettings.tsx @@ -15,7 +15,7 @@ import { FormEvent, Fragment, ReactElement, useState } from "react"; import { useTranslation } from "react-i18next"; import { show } from "vanilla-cookieconsent"; -import { AutocompleteSetting, User } from "api/models"; +import { OffOnSetting, User } from "api/models"; import { isEmailTaken, updateUser } from "backend"; import { getAvatar, getCurrentUser } from "backend/localStorage"; import { asyncLoadSemanticDomains } from "components/Project/ProjectActions"; @@ -252,15 +252,15 @@ export function UserSettings(props: { data-testid={UserSettingsIds.SelectGlossSuggestion} id={UserSettingsIds.SelectGlossSuggestion} onChange={(e) => - setGlossSuggestion(e.target.value as AutocompleteSetting) + setGlossSuggestion(e.target.value as OffOnSetting) } value={glossSuggestion} variant="standard" > - + {t("projectSettings.autocomplete.off")} - + {t("projectSettings.autocomplete.on")} diff --git a/src/types/project.ts b/src/types/project.ts index c0d70abf89..6a9985f221 100644 --- a/src/types/project.ts +++ b/src/types/project.ts @@ -1,4 +1,4 @@ -import { AutocompleteSetting, ConsentType, Project, Speaker } from "api/models"; +import { ConsentType, OffOnSetting, Project, Speaker } from "api/models"; import { newWritingSystem } from "types/writingSystem"; import { randomIntString } from "utilities/utilities"; @@ -10,6 +10,7 @@ export function newProject(name = ""): Project { liftImported: false, definitionsEnabled: false, grammaticalInfoEnabled: false, + autocompleteSetting: OffOnSetting.On, semanticDomains: [], semDomWritingSystem: newWritingSystem(), vernacularWritingSystem: newWritingSystem(), @@ -17,7 +18,6 @@ export function newProject(name = ""): Project { validCharacters: [], rejectedCharacters: [], inviteTokens: [], - autocompleteSetting: AutocompleteSetting.On, }; } diff --git a/src/types/user.ts b/src/types/user.ts index 29d6d0177c..6ea2534882 100644 --- a/src/types/user.ts +++ b/src/types/user.ts @@ -1,4 +1,4 @@ -import { AutocompleteSetting, User } from "api/models"; +import { OffOnSetting, User } from "api/models"; export function newUser(name = "", username = "", password = ""): User { return { @@ -12,7 +12,7 @@ export function newUser(name = "", username = "", password = ""): User { phone: "", projectRoles: {}, workedProjects: {}, - glossSuggestion: AutocompleteSetting.On, + glossSuggestion: OffOnSetting.On, token: "", isAdmin: false, }; From 293e2024f70a01dc4f50e9abee81751a298d0b51 Mon Sep 17 00:00:00 2001 From: "D. Ror." Date: Wed, 8 Jan 2025 13:19:52 -0500 Subject: [PATCH 2/2] [MergeDups] Unify sense-reference info (#3490) --- .../MergeDupsStep/MergeDragDrop/DragSense.tsx | 35 ++++++++----------- .../MergeDupsStep/MergeDragDrop/DropWord.tsx | 8 +++-- .../MergeDragDrop/SidebarDragSense.tsx | 13 +++---- .../MergeDragDrop/SidebarDrop.tsx | 13 ++++--- .../MergeDragDrop/tests/index.test.tsx | 2 +- .../MergeDuplicates/MergeDupsTreeTypes.ts | 9 ++--- .../MergeDuplicates/Redux/MergeDupsReducer.ts | 2 +- .../Redux/tests/MergeDupsReducer.test.tsx | 9 +++-- 8 files changed, 42 insertions(+), 49 deletions(-) diff --git a/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/DragSense.tsx b/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/DragSense.tsx index fcbe4e8660..85188ed472 100644 --- a/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/DragSense.tsx +++ b/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/DragSense.tsx @@ -1,10 +1,13 @@ import { Card } from "@mui/material"; -import { ReactElement, useCallback, useEffect, useState } from "react"; +import { type ReactElement, useCallback, useEffect, useState } from "react"; import { Draggable } from "react-beautiful-dnd"; import { trashId } from "goals/MergeDuplicates/MergeDupsStep/MergeDragDrop"; import SenseCardContent from "goals/MergeDuplicates/MergeDupsStep/SenseCardContent"; -import { MergeTreeSense } from "goals/MergeDuplicates/MergeDupsTreeTypes"; +import { + type MergeTreeReference, + type MergeTreeSense, +} from "goals/MergeDuplicates/MergeDupsTreeTypes"; import { setSidebar } from "goals/MergeDuplicates/Redux/MergeDupsActions"; import { useAppDispatch, useAppSelector } from "rootRedux/hooks"; import { type StoreState } from "rootRedux/types"; @@ -12,11 +15,9 @@ import theme from "types/theme"; interface DragSenseProps { index: number; - wordId: string; - mergeSenseId: string; - mergeSenses: MergeTreeSense[]; isOnlySenseInProtectedWord: boolean; - isProtectedSense: boolean; + mergeSenses: MergeTreeSense[]; + senseRef: MergeTreeReference; } function arraysEqual(arr1: T[], arr2: T[]): boolean { @@ -45,17 +46,13 @@ export default function DragSense(props: DragSenseProps): ReactElement { (state: StoreState) => state.mergeDuplicateGoal.tree.sidebar ); const isInSidebar = - sidebar.wordId === props.wordId && - sidebar.mergeSenseId === props.mergeSenseId && + sidebar.senseRef.wordId === props.senseRef.wordId && + sidebar.senseRef.mergeSenseId === props.senseRef.mergeSenseId && sidebar.mergeSenses.length > 1; const updateSidebar = useCallback(() => { dispatch( - setSidebar({ - mergeSenses: props.mergeSenses, - wordId: props.wordId, - mergeSenseId: props.mergeSenseId, - }) + setSidebar({ mergeSenses: props.mergeSenses, senseRef: props.senseRef }) ); }, [dispatch, props]); @@ -88,12 +85,8 @@ export default function DragSense(props: DragSenseProps): ReactElement { return ( @@ -109,13 +102,13 @@ export default function DragSense(props: DragSenseProps): ReactElement { minWidth: 150, maxWidth: 300, opacity: - !props.isProtectedSense && + !props.senseRef.isSenseProtected && (snapshot.draggingOver === trashId || snapshot.combineWith) ? 0.7 : 1, background: isInSidebar ? "lightblue" - : props.isProtectedSense + : props.senseRef.isSenseProtected ? "lightyellow" : snapshot.draggingOver === trashId ? "red" diff --git a/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/DropWord.tsx b/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/DropWord.tsx index 2d80007ec7..a752d59399 100644 --- a/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/DropWord.tsx +++ b/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/DropWord.tsx @@ -75,11 +75,13 @@ export default function DropWord(props: DropWordProps): ReactElement { ); })} diff --git a/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/SidebarDragSense.tsx b/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/SidebarDragSense.tsx index 0708d9dbe1..0abbde80f0 100644 --- a/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/SidebarDragSense.tsx +++ b/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/SidebarDragSense.tsx @@ -1,13 +1,10 @@ import { Card } from "@mui/material"; -import { ReactElement } from "react"; +import { type ReactElement } from "react"; import { Draggable } from "react-beautiful-dnd"; import { trashId } from "goals/MergeDuplicates/MergeDupsStep/MergeDragDrop"; import SenseCardContent from "goals/MergeDuplicates/MergeDupsStep/SenseCardContent"; -import { - MergeTreeReference, - MergeTreeSense, -} from "goals/MergeDuplicates/MergeDupsTreeTypes"; +import { type MergeTreeSense } from "goals/MergeDuplicates/MergeDupsTreeTypes"; import { useAppSelector } from "rootRedux/hooks"; import { type StoreState } from "rootRedux/types"; import theme from "types/theme"; @@ -21,10 +18,8 @@ export default function SidebarDragSense( props: SidebarDragSenseProps ): ReactElement { const draggableId = useAppSelector((state: StoreState) => { - const { mergeSenseId, wordId } = state.mergeDuplicateGoal.tree.sidebar; - const order = props.index; - const ref: MergeTreeReference = { wordId, mergeSenseId, order }; - return JSON.stringify(ref); + const ref = state.mergeDuplicateGoal.tree.sidebar.senseRef; + return JSON.stringify({ ...ref, order: props.index }); }); return ( diff --git a/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/SidebarDrop.tsx b/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/SidebarDrop.tsx index aa11fc5853..b7186483d5 100644 --- a/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/SidebarDrop.tsx +++ b/src/goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/SidebarDrop.tsx @@ -1,10 +1,10 @@ import { ArrowForwardIos, HelpOutline } from "@mui/icons-material"; import { Grid, IconButton, Typography } from "@mui/material"; -import { ReactElement } from "react"; +import { type ReactElement } from "react"; import { Droppable } from "react-beautiful-dnd"; import SidebarDragSense from "goals/MergeDuplicates/MergeDupsStep/MergeDragDrop/SidebarDragSense"; -import { MergeTreeSense } from "goals/MergeDuplicates/MergeDupsTreeTypes"; +import { type MergeTreeSense } from "goals/MergeDuplicates/MergeDupsTreeTypes"; import { setSidebar } from "goals/MergeDuplicates/Redux/MergeDupsActions"; import { useAppDispatch, useAppSelector } from "rootRedux/hooks"; import { type StoreState } from "rootRedux/types"; @@ -17,14 +17,13 @@ export default function SidebarDrop(): ReactElement { ); const vernacular = useAppSelector((state: StoreState) => { const tree = state.mergeDuplicateGoal.tree; - return tree.words[tree.sidebar.wordId]?.vern; + return tree.words[tree.sidebar.senseRef.wordId]?.vern; }); + const { mergeSenseId, wordId } = sidebar.senseRef; + return ( - + {(providedDroppable): ReactElement => (
{ }); expect(mockSetSidebar).toHaveBeenCalledTimes(1); const callArg = mockSetSidebar.mock.calls[0][0]; - expect(callArg.mergeSenseId).toEqual("word1_senseA"); + expect(callArg.senseRef.mergeSenseId).toEqual("word1_senseA"); }); }); diff --git a/src/goals/MergeDuplicates/MergeDupsTreeTypes.ts b/src/goals/MergeDuplicates/MergeDupsTreeTypes.ts index c27d7a0fcd..44aea74ae6 100644 --- a/src/goals/MergeDuplicates/MergeDupsTreeTypes.ts +++ b/src/goals/MergeDuplicates/MergeDupsTreeTypes.ts @@ -95,14 +95,15 @@ export function convertWordToMergeTreeWord(word: Word): MergeTreeWord { export interface Sidebar { mergeSenses: MergeTreeSense[]; - wordId: string; - mergeSenseId: string; + senseRef: MergeTreeReference; } export const defaultSidebar: Sidebar = { mergeSenses: [], - wordId: "", - mergeSenseId: "", + senseRef: { + wordId: "", + mergeSenseId: "", + }, }; export interface MergeTree { diff --git a/src/goals/MergeDuplicates/Redux/MergeDupsReducer.ts b/src/goals/MergeDuplicates/Redux/MergeDupsReducer.ts index 0169862abe..6f38786068 100644 --- a/src/goals/MergeDuplicates/Redux/MergeDupsReducer.ts +++ b/src/goals/MergeDuplicates/Redux/MergeDupsReducer.ts @@ -91,7 +91,7 @@ const mergeDuplicatesSlice = createSlice({ } // If the deleted sense was open in the sidebar, reset the sidebar. - const { mergeSenseId, wordId } = state.tree.sidebar; + const { mergeSenseId, wordId } = state.tree.sidebar.senseRef; if (mergeSenseId === srcRef.mergeSenseId && wordId === srcRef.wordId) { state.tree.sidebar = defaultSidebar; } diff --git a/src/goals/MergeDuplicates/Redux/tests/MergeDupsReducer.test.tsx b/src/goals/MergeDuplicates/Redux/tests/MergeDupsReducer.test.tsx index d4e62a6d01..77ab8eed44 100644 --- a/src/goals/MergeDuplicates/Redux/tests/MergeDupsReducer.test.tsx +++ b/src/goals/MergeDuplicates/Redux/tests/MergeDupsReducer.test.tsx @@ -100,8 +100,11 @@ describe("MergeDupsReducer", () => { ...defaultTree, sidebar: { ...defaultSidebar, - mergeSenseId: "word2_senseA", - wordId: "word2", + senseRef: { + ...defaultSidebar.senseRef, + mergeSenseId: "word2_senseA", + wordId: "word2", + }, }, words: testTreeWords(), }, @@ -114,7 +117,7 @@ describe("MergeDupsReducer", () => { sidebarClosed = false ): void { const { sidebar, words } = mergeDupStepReducer(mockState, action).tree; - expect(!sidebar.wordId).toEqual(sidebarClosed); + expect(!sidebar.senseRef.wordId).toEqual(sidebarClosed); // Stringify for this test, because order within `.sensesGuids` matters. expect(JSON.stringify(words)).toEqual(JSON.stringify(expectedWords)); }