Added git reset to test

This commit is contained in:
Shahan Nedadahandeh 2023-04-05 12:52:26 -04:00
parent d9b7476a9e
commit 31d73dbcc7
1 changed files with 2 additions and 1 deletions

View File

@ -6,7 +6,7 @@ import {
removeRepo,
} from "../gitClient";
import { existsSync, readdirSync } from "fs";
import { execSync } from "child_process";
import { exec, execSync } from "child_process";
test("successfully clones repo", async () => {
const folderPath = await cloneRepo("https://github.com/octocat/Spoon-Knife");
@ -23,6 +23,7 @@ test("successfully commits to repo", async () => {
try {
execSync(`cd ${folderPath} && touch newFile.ts`);
await commitRepo(folderPath);
execSync("git reset --hard"); // hard reset to delete any uncommitted files
const directoryContents = readdirSync(folderPath);
expect(directoryContents).toContain("newFile.ts");
} catch (error) {