Skip to content

Commit

Permalink
fix: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkmcadoo committed Dec 15, 2021
1 parent 10f2789 commit 7eb2b21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,17 @@ describe('add-files-to-translation-queue tests', () => {

describe('Queue translations', () => {
test('Adds the Human Translation Project Id for locale under `translate` in frontmatter', async () => {
const file = { filename: '/content/bar.mdx' };
const file = '/content/bar.mdx';
mockReadFileSync(['jp']);
frontmatter.mockReturnValueOnce({ data: { translate: ['jp'] } });
const toBeTranslated = getLocalizedFileData(file);

expect(toBeTranslated).toEqual([
{ filename: '/content/bar.mdx', locale: 'ja-JP', project_id: 'HT_ID' },
]);
});

test('Adds the Machine Translation Project Id when there is no `translate` in frontmatter', async () => {
const file = { filename: '/content/bar.mdx' };
const file = '/content/bar.mdx';
mockReadFileSync();
frontmatter.mockReturnValueOnce({ data: {} });
const toBeTranslated = getLocalizedFileData(file);
Expand All @@ -79,7 +78,7 @@ describe('add-files-to-translation-queue tests', () => {
});

test('Adds the relevant Project Id when there are multiple locales and only one `translate` in frontmatter', async () => {
const file = { filename: '/content/bar.mdx' };
const file = '/content/bar.mdx';
const originalAdd = jest.requireActual('../utils/constants.js');

jest.doMock('../utils/constants.js', () => {
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4649,6 +4649,11 @@ commander@^7.1.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7"
integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==

commander@^8.3.0:
version "8.3.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==

commander@~2.9.0:
version "2.9.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4"
Expand Down

0 comments on commit 7eb2b21

Please sign in to comment.