-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into alanwest/otel-logs
- Loading branch information
Showing
115 changed files
with
2,260 additions
and
515 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
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
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,48 @@ | ||
import fetchAndDeserialize from '../fetch-and-deserialize'; | ||
const fse = require('fs-extra'); | ||
const vfile = require('vfile'); | ||
const { writeSync } = require('to-vfile'); | ||
|
||
jest.mock('fs-extra'); | ||
jest.mock('to-vfile'); | ||
|
||
describe('writeFilesSync', () => { | ||
const testFiles = [ | ||
vfile({ | ||
contents: 'fake_content', | ||
path: 'src/i18n/content/jp/docs/fake_path_1/fake_file_1.mdx', | ||
extname: '.mdx', | ||
}), | ||
vfile({ | ||
contents: 'fake_content', | ||
path: 'src/i18n/content/jp/docs/fake_path_1/fake_file_2.mdx', | ||
extname: '.mdx', | ||
}), | ||
vfile({ | ||
contents: 'fake_content', | ||
path: 'src/i18n/content/jp/docs/fake_path_2/fake_file_3.mdx', | ||
extname: '.mdx', | ||
}), | ||
]; | ||
|
||
fse.existsSync.mockClear(); | ||
fse.existsSync.mockReturnValue(true); | ||
fetchAndDeserialize.writeFilesSync(testFiles); | ||
|
||
it('should call writeSync for each file', () => { | ||
expect(writeSync).toHaveBeenCalledTimes(testFiles.length); | ||
}); | ||
|
||
it('should call copySync for each unique directory path', () => { | ||
expect(fse.copySync).toHaveBeenCalledTimes(2); | ||
}); | ||
|
||
it('should not copy directories that dont have images', () => { | ||
fse.existsSync.mockClear(); | ||
fse.existsSync.mockReturnValue(false); | ||
fse.copySync.mockClear(); | ||
fetchAndDeserialize.writeFilesSync(testFiles); | ||
|
||
expect(fse.copySync).toHaveBeenCalledTimes(0); | ||
}); | ||
}); |
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
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
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
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
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
Oops, something went wrong.