From c5f77887768eecb381e0d64973447a1bacd370e9 Mon Sep 17 00:00:00 2001 From: Michael Padon Date: Wed, 3 Apr 2019 15:04:02 -0500 Subject: [PATCH] Rename the static snapshot service start command --- src/commands/snapshot.ts | 3 +-- src/services/static-snapshot-service.ts | 2 +- test/commands/snapshot.test.ts | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/commands/snapshot.ts b/src/commands/snapshot.ts index ff939d15..13280f90 100644 --- a/src/commands/snapshot.ts +++ b/src/commands/snapshot.ts @@ -80,8 +80,7 @@ export default class Snapshot extends PercyCommand { this.logStart() // need to start the snapshot service - // NEED A DIFFERENT PORT HERE - const staticSnapshotService = this.staticSnapshotService.start({ + const staticSnapshotService = this.staticSnapshotService.snapshot({ port: portPlusOne, staticAssetDirectory, widths, diff --git a/src/services/static-snapshot-service.ts b/src/services/static-snapshot-service.ts index ed568288..8bf07a44 100644 --- a/src/services/static-snapshot-service.ts +++ b/src/services/static-snapshot-service.ts @@ -6,7 +6,7 @@ export default class StaticSnapshotService { // logger.info('calling constructor...') } - async start(options: StaticSnapshotOptions) { + async snapshot(options: StaticSnapshotOptions) { // logger.info('starting static snapshot service...') } diff --git a/test/commands/snapshot.test.ts b/test/commands/snapshot.test.ts index 4c03da22..2c33fc5f 100644 --- a/test/commands/snapshot.test.ts +++ b/test/commands/snapshot.test.ts @@ -1,9 +1,9 @@ import * as chai from 'chai' -import {describe} from 'mocha' import * as sinon from 'sinon' import Snapshot from '../../src/commands/snapshot' import AgentService from '../../src/services/agent-service' import StaticSnapshotService from '../../src/services/static-snapshot-service' +import {describe} from 'mocha' import {captureStdOut} from '../helpers/stdout' import {expect, test} from '@oclif/test' @@ -28,7 +28,7 @@ describe('snapshot', () => { function StaticSnapshotServiceStub(): StaticSnapshotService { const staticSnapshotService = StaticSnapshotService.prototype as StaticSnapshotService - sandbox.stub(staticSnapshotService, 'start') + sandbox.stub(staticSnapshotService, 'snapshot') const snapshot = new Snapshot([], '') as Snapshot sandbox.stub(snapshot, 'staticSnapshotService').returns(staticSnapshotService) @@ -55,7 +55,7 @@ describe('snapshot', () => { }) chai.expect(agentServiceStub.start).to.be.calledWith(expectedAgentOptions) - chai.expect(staticSnapshotServiceStub.start).to.be.calledWith(expectedSnapshotOptions) + chai.expect(staticSnapshotServiceStub.snapshot).to.be.calledWith(expectedSnapshotOptions) chai.expect(stdout).to.match(/\[percy\] percy has started./) }) @@ -94,7 +94,7 @@ describe('snapshot', () => { }) chai.expect(stdout).to.match(/\[percy\] percy has started./) - chai.expect(staticSnapshotServiceStub.start).to.be.calledWith(expectedSnapshotOptions) + chai.expect(staticSnapshotServiceStub.snapshot).to.be.calledWith(expectedSnapshotOptions) chai.expect(agentServiceStub.start).to.be.calledWith(expectedAgentOptions) }) })