Skip to content

Commit

Permalink
office-addin-dev-certs: fix uninstall and verify commands too (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
akrantz authored Aug 16, 2019
1 parent cfe4e83 commit 8b85647
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/office-addin-dev-certs/src/uninstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function getUninstallCommand(machine: boolean = false): string {
switch (process.platform) {
case "win32":
const script = path.resolve(__dirname, "..\\scripts\\uninstall.ps1");
return `powershell -ExecutionPolicy Bypass -File ${script} ${machine ? "LocalMachine" : "CurrentUser"} '${defaults.certificateName}'`;
return `powershell -ExecutionPolicy Bypass -File "${script}" ${machine ? "LocalMachine" : "CurrentUser"} "${defaults.certificateName}"`;
case "darwin": // macOS
return `sudo security delete-certificate -c '${defaults.certificateName}'`;
default:
Expand Down
2 changes: 1 addition & 1 deletion packages/office-addin-dev-certs/src/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function getVerifyCommand(): string {
switch (process.platform) {
case "win32":
const script = path.resolve(__dirname, "..\\scripts\\verify.ps1");
return `powershell -ExecutionPolicy Bypass -File ${script} '${defaults.certificateName}'`;
return `powershell -ExecutionPolicy Bypass -File "${script}" "${defaults.certificateName}"`;
case "darwin": // macOS
return `security find-certificate -c '${defaults.certificateName}' -p | openssl x509 -checkend 86400 -noout`;
default:
Expand Down
4 changes: 2 additions & 2 deletions packages/office-addin-dev-certs/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe("office-addin-dev-certs", function() {
sandbox.stub(verify, "isCaCertificateInstalled").callsFake(isCaCertificateInstalled);
await uninstall.uninstallCaCertificate(machine);
assert.strictEqual(execSync.callCount, 1);
assert.strictEqual(execSync.calledWith(`powershell -ExecutionPolicy Bypass -File ${script} LocalMachine '${defaults.certificateName}'`), true);
assert.strictEqual(execSync.calledWith(`powershell -ExecutionPolicy Bypass -File "${script}" LocalMachine "${defaults.certificateName}"`), true);
});
it("without --machine option", async function() {
const isCaCertificateInstalled = sandbox.fake.returns(true);
Expand All @@ -207,7 +207,7 @@ describe("office-addin-dev-certs", function() {
sandbox.stub(verify, "isCaCertificateInstalled").callsFake(isCaCertificateInstalled);
await uninstall.uninstallCaCertificate(machine);
assert.strictEqual(execSync.callCount, 1);
assert.strictEqual(execSync.calledWith(`powershell -ExecutionPolicy Bypass -File ${script} CurrentUser '${defaults.certificateName}'`), true);
assert.strictEqual(execSync.calledWith(`powershell -ExecutionPolicy Bypass -File "${script}" CurrentUser "${defaults.certificateName}"`), true);
});
}
});
Expand Down

0 comments on commit 8b85647

Please sign in to comment.