forked from cline/cline
-
Notifications
You must be signed in to change notification settings - Fork 577
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,422 additions
and
812 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -9,6 +9,8 @@ import { simpleGit, SimpleGit } from "simple-git" | |
import { CheckpointServiceFactory } from "../CheckpointServiceFactory" | ||
import { LocalCheckpointService } from "../LocalCheckpointService" | ||
|
||
const tmpDir = path.join(os.tmpdir(), "test-LocalCheckpointService") | ||
|
||
describe("LocalCheckpointService", () => { | ||
const taskId = "test-task" | ||
|
||
|
@@ -29,7 +31,7 @@ describe("LocalCheckpointService", () => { | |
textFileContent?: string | ||
}) => { | ||
// Create a temporary directory for testing. | ||
await fs.mkdir(workspaceDir) | ||
await fs.mkdir(workspaceDir, { recursive: true }) | ||
|
||
// Initialize git repo. | ||
const git = simpleGit(workspaceDir) | ||
|
@@ -49,7 +51,7 @@ describe("LocalCheckpointService", () => { | |
} | ||
|
||
beforeEach(async () => { | ||
const workspaceDir = path.join(os.tmpdir(), `checkpoint-service-test-${Date.now()}`) | ||
const workspaceDir = path.join(tmpDir, `checkpoint-service-test-${Date.now()}`) | ||
const repo = await initRepo({ workspaceDir }) | ||
|
||
testFile = repo.testFile | ||
|
@@ -60,10 +62,13 @@ describe("LocalCheckpointService", () => { | |
}) | ||
|
||
afterEach(async () => { | ||
await fs.rm(service.workspaceDir, { recursive: true, force: true }) | ||
jest.restoreAllMocks() | ||
}) | ||
|
||
afterAll(async () => { | ||
await fs.rm(tmpDir, { recursive: true, force: true }) | ||
}) | ||
|
||
describe("getDiff", () => { | ||
it("returns the correct diff between commits", async () => { | ||
await fs.writeFile(testFile, "Ahoy, world!") | ||
|
@@ -316,7 +321,7 @@ describe("LocalCheckpointService", () => { | |
|
||
describe("create", () => { | ||
it("initializes a git repository if one does not already exist", async () => { | ||
const workspaceDir = path.join(os.tmpdir(), `checkpoint-service-test2-${Date.now()}`) | ||
const workspaceDir = path.join(tmpDir, `checkpoint-service-test2-${Date.now()}`) | ||
await fs.mkdir(workspaceDir) | ||
const newTestFile = path.join(workspaceDir, "test.txt") | ||
await fs.writeFile(newTestFile, "Hello, world!") | ||
|
@@ -364,7 +369,7 @@ describe("LocalCheckpointService", () => { | |
}) | ||
|
||
it("respects existing git user configuration", async () => { | ||
const workspaceDir = path.join(os.tmpdir(), `checkpoint-service-test-config2-${Date.now()}`) | ||
const workspaceDir = path.join(tmpDir, `checkpoint-service-test-config2-${Date.now()}`) | ||
const userName = "Custom User" | ||
const userEmail = "[email protected]" | ||
await initRepo({ workspaceDir, userName, userEmail }) | ||
|
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"extends": "react-app" | ||
"extends": "react-app", | ||
"ignorePatterns": ["!.storybook"] | ||
} |
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.