Skip to content

Commit

Permalink
Rename the static snapshot service start command
Browse files Browse the repository at this point in the history
  • Loading branch information
maprules1000 committed Apr 10, 2019
1 parent 37f8c5d commit c5f7788
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/commands/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/services/static-snapshot-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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...')
}

Expand Down
8 changes: 4 additions & 4 deletions test/commands/snapshot.test.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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)
Expand All @@ -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./)
})

Expand Down Expand Up @@ -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)
})
})
Expand Down

0 comments on commit c5f7788

Please sign in to comment.