Skip to content

Commit

Permalink
fix: Combine rollback log statement into one string (#290)
Browse files Browse the repository at this point in the history
Strings were being logged out of order at random for some reason. Seemed cleaner anyway to just combine them into one string and adjusted tests.
  • Loading branch information
tbarlow12 authored Sep 3, 2019
1 parent 8d3931d commit 5806757
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 2 additions & 5 deletions src/services/rollbackService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,8 @@ describe("Rollback Service", () => {
const options = {} as any;
const service = createService(sls, options);
await service.rollback();
expect(sls.cli.log).lastCalledWith(
deploymentString,
undefined,
undefined
);
const logCalls: any[][] = (sls.cli.log as any).mock.calls;
expect(logCalls[logCalls.length - 1][0].endsWith(deploymentString)).toBe(true);
});

it("should return early with invalid timestamp", async () => {
Expand Down
8 changes: 4 additions & 4 deletions src/services/rollbackService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ export class RollbackService extends BaseService {
private async getDeployment(): Promise<DeploymentExtended> {
let timestamp = Utils.get(this.options, "timestamp");
if (!timestamp) {
this.log("Need to specify a timestamp for rollback.");
this.log("Example usage:\n\nsls rollback -t 1562014362");
this.log(await this.resourceService.listDeployments());
return null;
this.log("Need to specify a timestamp for rollback.\n\n" +
"Example usage:\n\nsls rollback -t 1562014362\n\n" +
await this.resourceService.listDeployments());
return;
}
const deployments = await this.getArmDeploymentsByTimestamp();
const deployment = deployments.get(timestamp);
Expand Down

0 comments on commit 5806757

Please sign in to comment.