Skip to content

Commit

Permalink
🧪 test: numeric value in the import JSON structure (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: david-vaclavek <david@localazy.com>
  • Loading branch information
david-vaclavek and david-vaclavek authored Apr 18, 2024
1 parent a734f6f commit 0fbf89f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/specs/import.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ describe('Import', (): void => {
});

test('api.import.json', async (): Promise<void> => {
const json: I18nJson = { en: { headers: { person: 'Active person' } } };
const json: I18nJson = { en: { headers: { person: 'Active person' }, 99: { luft: 'baloons' } } };
const request: ImportJsonRequest = { project, json, fileOptions: { name: 'en.json' } };
const spy: MockInstance = vi.spyOn(globalThis, 'fetch');
await api.import.json(request);

expect(spy).toHaveBeenCalledWith('https://api.localazy.com/projects/_a0000000000000000001/import', {
body: '{"files":[{"name":"en.json","content":{"type":"json","en":{"headers":{"person":"Active person"}}}}]}',
// eslint-disable-next-line max-len
body: '{"files":[{"name":"en.json","content":{"type":"json","en":{"99":{"luft":"baloons"},"headers":{"person":"Active person"}}}}]}',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${getToken()}`,
Expand Down

0 comments on commit 0fbf89f

Please sign in to comment.