Skip to content

Commit

Permalink
feat(test): getMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustinMauroy committed Sep 12, 2023
1 parent 00e6056 commit edb6f77
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/lib/__tests__/getMessage.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import getMessages from '../getMessage';

describe('getMessages', () => {
it('should return the messages for the specified language', () => {
const messages = getMessages('fr');
expect(messages).toBeTruthy();
});

it('should throw an error if the default language file is not found', () => {
jest.spyOn(process, 'cwd').mockReturnValue('/path/to/invalid/dir');
expect(() => getMessages('en')).toThrowError(
'No language file found, searchfile /path/to/invalid/dir/i18n/locales/en.json',
);
});
});

0 comments on commit edb6f77

Please sign in to comment.