diff --git a/src/types/glossary-create-request.ts b/src/types/glossary-create-request.ts index 80a5f4b..8832a69 100644 --- a/src/types/glossary-create-request.ts +++ b/src/types/glossary-create-request.ts @@ -22,6 +22,12 @@ export type GlossaryCreateRequest = { */ caseSensitive: boolean; + /** + * Whether the term must match exactly (as opposed to matching any inflected form). + * Defaults to `true` server-side when omitted. + */ + exactMatch?: boolean; + /** * Contains an array of the term and it’s translations. */ diff --git a/src/types/glossary-record.ts b/src/types/glossary-record.ts index c3b74f2..f29d7e7 100644 --- a/src/types/glossary-record.ts +++ b/src/types/glossary-record.ts @@ -21,6 +21,11 @@ export type GlossaryRecord = { */ caseSensitive: boolean; + /** + * Whether the term must match exactly (as opposed to matching any inflected form). + */ + exactMatch: boolean; + /** * Contains an array of the term and it’s translations. */ diff --git a/src/types/glossary-update-request.ts b/src/types/glossary-update-request.ts index 200b9c0..8e486bb 100644 --- a/src/types/glossary-update-request.ts +++ b/src/types/glossary-update-request.ts @@ -28,6 +28,12 @@ export type GlossaryUpdateRequest = { */ caseSensitive: boolean; + /** + * Whether the term must match exactly (as opposed to matching any inflected form). + * Defaults to `true` server-side when omitted. + */ + exactMatch?: boolean; + /** * Contains an array of the term and it’s translations. */ diff --git a/tests/fixtures/full-project/glossary.json b/tests/fixtures/full-project/glossary.json index dd77317..d77c1a3 100644 --- a/tests/fixtures/full-project/glossary.json +++ b/tests/fixtures/full-project/glossary.json @@ -10,7 +10,8 @@ ], "description": "A screen used for displaying visual output from a computer.", "translateTerm": false, - "caseSensitive": false + "caseSensitive": false, + "exactMatch": true } ] } diff --git a/tests/specs/glossary.spec.ts b/tests/specs/glossary.spec.ts index 381b8d1..859ad2c 100644 --- a/tests/specs/glossary.spec.ts +++ b/tests/specs/glossary.spec.ts @@ -32,6 +32,7 @@ describe('Glossary', (): void => { expect(firstRecord.description).toBe( 'A screen used for displaying visual output from a computer.', ); + expect(firstRecord.exactMatch).toBe(true); }); test('api.glossary.find', async (): Promise => { @@ -94,6 +95,7 @@ describe('Glossary', (): void => { description: 'Exceptional term description', caseSensitive: true, translateTerm: true, + exactMatch: false, term: [{ lang: 'en', term: 'Exceptional term' }], }; const spy: MockInstance = vi.spyOn(globalThis, 'fetch'); @@ -102,7 +104,7 @@ describe('Glossary', (): void => { expect(spy).toHaveBeenCalledWith( 'https://api.localazy.com/projects/_a0000000000000000001/glossary/_a0000000000000000001', { - body: '{"description":"Exceptional term description","caseSensitive":true,"translateTerm":true,"term":[{"lang":"en","term":"Exceptional term"}]}', + body: '{"description":"Exceptional term description","caseSensitive":true,"translateTerm":true,"exactMatch":false,"term":[{"lang":"en","term":"Exceptional term"}]}', headers: { Accept: 'application/json', Authorization: `Bearer ${getToken()}`,