Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Shimloader tests #1352

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading