Add VCS fixtures

This commit is contained in:
sebastien 2025-10-31 13:21:26 +01:00
parent 67317a9677
commit bf56b8b3fd
7 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1 @@
A site fixture with files versioned on Git.

View File

@ -0,0 +1 @@
Blog 1

View File

@ -0,0 +1,3 @@
This is a partial in file/folder starting with _:
It should be excluded by default

View File

@ -0,0 +1 @@
Doc 1

View File

@ -0,0 +1 @@
Doc 2

View File

@ -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'), {