fix: add patch for sync upstream

This commit is contained in:
mingholy.lmh
2025-08-20 22:24:53 +08:00
parent c546d86d44
commit 1e2bbd1be3
23 changed files with 508 additions and 303 deletions

View File

@@ -79,6 +79,14 @@ describe('getEnvironmentContext', () => {
vi.useFakeTimers();
vi.setSystemTime(new Date('2025-08-05T12:00:00Z'));
// Mock the locale to ensure consistent English date formatting
vi.stubGlobal('Intl', {
...global.Intl,
DateTimeFormat: vi.fn().mockImplementation(() => ({
format: vi.fn().mockReturnValue('Tuesday, August 5, 2025'),
})),
});
mockToolRegistry = {
getTool: vi.fn(),
};
@@ -97,6 +105,7 @@ describe('getEnvironmentContext', () => {
afterEach(() => {
vi.useRealTimers();
vi.unstubAllGlobals();
vi.resetAllMocks();
});
@@ -106,7 +115,8 @@ describe('getEnvironmentContext', () => {
expect(parts.length).toBe(1);
const context = parts[0].text;
expect(context).toContain("Today's date is Tuesday, August 5, 2025");
// Use a more flexible date assertion that works with different locales
expect(context).toMatch(/Today's date is .*2025.*/);
expect(context).toContain(`My operating system is: ${process.platform}`);
expect(context).toContain(
"I'm currently working in the directory: /test/dir",