From dd5940f22542759cab687702982a405b9a7192ab Mon Sep 17 00:00:00 2001 From: sharpchen Date: Tue, 24 Sep 2024 00:08:35 +0800 Subject: [PATCH] grrr --- docs/services/SidebarService.ts | 2 +- docs/test/firstTrackedDate.test.ts | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/services/SidebarService.ts b/docs/services/SidebarService.ts index f25a6c98..28923670 100644 --- a/docs/services/SidebarService.ts +++ b/docs/services/SidebarService.ts @@ -50,7 +50,7 @@ class SidebarService implements ISidebarService { '--diff-filter=A', '--format="%cI"', '--', - `'${path.join(documentRoot().fullName, file)}'`, + `'${path.join(documentRoot().fullName, file)}.md'`, ]).stdout.toString(), ); console.log(foo); diff --git a/docs/test/firstTrackedDate.test.ts b/docs/test/firstTrackedDate.test.ts index 5918fb7d..928af7f7 100644 --- a/docs/test/firstTrackedDate.test.ts +++ b/docs/test/firstTrackedDate.test.ts @@ -3,17 +3,15 @@ import { basename, dirname } from 'node:path'; import * as fs from 'node:fs'; import { expect, test } from 'vitest'; import path from 'node:path'; -import { projectRoot } from '../shared/FileSystem'; +import { documentRoot, projectRoot } from '../shared/FileSystem'; -// test('expect date', () => { -// const foo = spawnSync('git', [ -// 'log', -// '-1', -// '--pretty="%ai"', -// path.join(projectRoot().fullName, 'package.json'), -// ]).stdout.toString(); -// expect(foo.startsWith('2024')).toBe(true); -// }); test('', () => { - expect(projectRoot().parent?.fullName).toBe('/home/sharpchen/desktop/repo/sharpchen.github.io'); + const foo = spawnSync('git', [ + 'log', + '--diff-filter=A', + '--format="%cI"', + '--', + `'${path.join(documentRoot().fullName, 'docs/test/firstTrackedDate.test.ts')}'`, + ]).stdout.toString(); + expect(foo.startsWith('2024')).toBe(true); });