Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/types/glossary-create-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
5 changes: 5 additions & 0 deletions src/types/glossary-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
6 changes: 6 additions & 0 deletions src/types/glossary-update-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/fixtures/full-project/glossary.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
],
"description": "A screen used for displaying visual output from a computer.",
"translateTerm": false,
"caseSensitive": false
"caseSensitive": false,
"exactMatch": true
}
]
}
4 changes: 3 additions & 1 deletion tests/specs/glossary.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> => {
Expand Down Expand Up @@ -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');
Expand All @@ -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()}`,
Expand Down