From a1cb996a220477c8fe61d4922cd4e3a3110d9758 Mon Sep 17 00:00:00 2001 From: Dringsim Date: Fri, 27 Oct 2023 13:33:00 +0800 Subject: [PATCH] Add the main lemma as form when creating a lexeme Bug: T346732 --- src/data-access/MwApiLexemeCreator.ts | 11 +++++++++++ tests/unit/data-access/MwApiLexemeCreator.test.ts | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/data-access/MwApiLexemeCreator.ts b/src/data-access/MwApiLexemeCreator.ts index 8e9ebe30..615d7a1b 100644 --- a/src/data-access/MwApiLexemeCreator.ts +++ b/src/data-access/MwApiLexemeCreator.ts @@ -44,6 +44,17 @@ export default class MwApiLexemeCreator implements LexemeCreator { }, language: lexemeLanguageItemId, lexicalCategory: lexicalCategoryItemId, + forms: [ + { + add: '', + representations: { + [ lemmaLanguageCode ]: { + language: lemmaLanguageCode, + value: lemma, + }, + }, + }, + ], } ), errorformat: 'html', formatversion: 2, diff --git a/tests/unit/data-access/MwApiLexemeCreator.test.ts b/tests/unit/data-access/MwApiLexemeCreator.test.ts index ba99f2a6..5f3045ea 100644 --- a/tests/unit/data-access/MwApiLexemeCreator.test.ts +++ b/tests/unit/data-access/MwApiLexemeCreator.test.ts @@ -44,6 +44,17 @@ describe( 'MwApiLexemeCreator', () => { }, language: 'Q123', lexicalCategory: 'Q456', + forms: [ + { + add: '', + representations: { + en: { + language: 'en', + value: 'lemma', + }, + }, + }, + ], } ), assert: 'user', errorformat: 'html',