Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2982 from newrelic/2931_fix_document_doesnt_exist…
…_bug enable translation workflow to handle 'sending' documents that dont exist
- Loading branch information
Showing
3 changed files
with
56 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ module.exports = { | |
tabWidth: 2, | ||
semi: true, | ||
singleQuote: true, | ||
arrowParens: 'always', | ||
}; |
23 changes: 23 additions & 0 deletions
23
scripts/actions/__tests__/send-and-update-translation-queue.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const fs = require('fs'); | ||
|
||
const { getContent } = require('../send-and-update-translation-queue'); | ||
|
||
jest.mock('../serialize-mdx'); | ||
jest.mock('fs'); | ||
|
||
test('getContent skips over files that dont exist', async () => { | ||
fs.existsSync | ||
.mockReturnValueOnce(false) | ||
.mockReturnValueOnce(false) | ||
.mockReturnValueOnce(false) | ||
.mockReturnValue(true); | ||
|
||
const mockInput = { | ||
jp: ['slug1', 'slug2', 'slug3', 'slug4', 'slug5'], | ||
}; | ||
|
||
const fileContent = getContent(mockInput); | ||
const pages = await fileContent['jp']; | ||
|
||
expect(pages.length).toBe(2); // 5 submitted slugs - 3 false mock returns = 2 files not skipped | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters