Skip to content

Commit

Permalink
Merge pull request #1352 from ebkr/shimloader-test
Browse files Browse the repository at this point in the history
Improve Shimloader tests
  • Loading branch information
anttimaki authored Jun 11, 2024
2 parents 29c0f8c + 7acae5d commit 1187a67
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions test/jest/__tests__/impl/install_logic/Shimloader.Tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ describe('Installer Tests', () => {
const expectedAfterUninstall = [
"shimloader/cfg/package.cfg",
];

const cachePkgRoot = path.join(PathResolver.MOD_ROOT, "cache", pkg.getName(), pkg.getVersionNumber().toString());
await fs.mkdirs(cachePkgRoot);

Expand Down Expand Up @@ -112,16 +113,18 @@ describe('Installer Tests', () => {

for (const destPath of Object.values(sourceToExpectedDestination)) {
const fullPath = path.join(profilePath, destPath);
const result = await fs.exists(fullPath);
if (result) {
const doesExist = await fs.exists(fullPath);
const shouldExist = expectedAfterUninstall.includes(destPath);

if (doesExist && !shouldExist) {
console.log(`Expected ${fullPath} to NOT exist but IT DOES! All files:`);
console.log(JSON.stringify(await getTree(profilePath), null, 2));
} else if (shouldExist && !doesExist) {
console.log(`Expected ${fullPath} to exist but IT DOESN'T! All files:`);
console.log(JSON.stringify(await getTree(profilePath), null, 2));
}
if (expectedAfterUninstall.indexOf(destPath) > -1) {
expect(result).toBeTruthy();
} else {
expect(result).toBeFalsy();
}

expect(doesExist).toEqual(shouldExist);
}
});
});
Expand Down

0 comments on commit 1187a67

Please sign in to comment.