mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-26 01:33:02 +00:00
Add VCS fixtures
This commit is contained in:
parent
67317a9677
commit
bf56b8b3fd
1
packages/docusaurus-utils/src/vcs/__tests__/__fixtures__/simple-site/README.md
generated
Normal file
1
packages/docusaurus-utils/src/vcs/__tests__/__fixtures__/simple-site/README.md
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
A site fixture with files versioned on Git.
|
||||
1
packages/docusaurus-utils/src/vcs/__tests__/__fixtures__/simple-site/blog/2025/blog2.md
generated
Normal file
1
packages/docusaurus-utils/src/vcs/__tests__/__fixtures__/simple-site/blog/2025/blog2.md
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
Blog 2
|
||||
1
packages/docusaurus-utils/src/vcs/__tests__/__fixtures__/simple-site/blog/blog1.md
generated
Normal file
1
packages/docusaurus-utils/src/vcs/__tests__/__fixtures__/simple-site/blog/blog1.md
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
Blog 1
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
This is a partial in file/folder starting with _:
|
||||
|
||||
It should be excluded by default
|
||||
1
packages/docusaurus-utils/src/vcs/__tests__/__fixtures__/simple-site/docs/doc1.md
generated
Normal file
1
packages/docusaurus-utils/src/vcs/__tests__/__fixtures__/simple-site/docs/doc1.md
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
Doc 1
|
||||
1
packages/docusaurus-utils/src/vcs/__tests__/__fixtures__/simple-site/docs/doc2.md
generated
Normal file
1
packages/docusaurus-utils/src/vcs/__tests__/__fixtures__/simple-site/docs/doc2.md
generated
Normal file
|
|
@ -0,0 +1 @@
|
|||
Doc 2
|
||||
|
|
@ -47,6 +47,7 @@ function initializeTempRepo() {
|
|||
|
||||
describe('getFileCommitDate', () => {
|
||||
const repoDir = initializeTempRepo();
|
||||
|
||||
it('returns earliest commit date', async () => {
|
||||
await expect(
|
||||
getFileCommitDate(path.join(repoDir, 'test.txt'), {}),
|
||||
|
|
@ -61,6 +62,7 @@ describe('getFileCommitDate', () => {
|
|||
timestamp: new Date('2020-09-13').getTime(),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns latest commit date', async () => {
|
||||
await expect(
|
||||
getFileCommitDate(path.join(repoDir, 'test.txt'), {age: 'newest'}),
|
||||
|
|
@ -75,6 +77,7 @@ describe('getFileCommitDate', () => {
|
|||
timestamp: new Date('2020-11-13').getTime(),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns latest commit date with author', async () => {
|
||||
await expect(
|
||||
getFileCommitDate(path.join(repoDir, 'test.txt'), {
|
||||
|
|
@ -97,6 +100,7 @@ describe('getFileCommitDate', () => {
|
|||
author: 'Caroline',
|
||||
});
|
||||
});
|
||||
|
||||
it('returns earliest commit date with author', async () => {
|
||||
await expect(
|
||||
getFileCommitDate(path.join(repoDir, 'test.txt'), {
|
||||
|
|
@ -119,6 +123,7 @@ describe('getFileCommitDate', () => {
|
|||
author: 'Josh-Cena',
|
||||
});
|
||||
});
|
||||
|
||||
it('throws custom error when file is not tracked', async () => {
|
||||
await expect(() =>
|
||||
getFileCommitDate(path.join(repoDir, 'untracked.txt'), {
|
||||
|
|
@ -127,6 +132,7 @@ describe('getFileCommitDate', () => {
|
|||
}),
|
||||
).rejects.toThrow(FileNotTrackedError);
|
||||
});
|
||||
|
||||
it('throws when file not found', async () => {
|
||||
await expect(() =>
|
||||
getFileCommitDate(path.join(repoDir, 'nonexistent.txt'), {
|
||||
|
|
|
|||
Loading…
Reference in New Issue