Skip to content

Commit

Permalink
chore(lint): ensure linting rules explicit about spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
mefellows committed Feb 20, 2018
1 parent 65ce38f commit 9d3bb0b
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 84 deletions.
2 changes: 1 addition & 1 deletion src/common/request.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as nock from "nock";
import {HTTPMethod, Request} from "./request";
import { HTTPMethod, Request } from "./request";

chai.use(chaiAsPromised);

Expand Down
4 changes: 2 additions & 2 deletions src/common/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
require("es6-object-assign").polyfill();

import * as Popsicle from "popsicle/dist/common";
import {Response} from "popsicle/dist/response";
import {logger} from "./logger";
import { Response } from "popsicle/dist/response";
import { logger } from "./logger";

export enum HTTPMethod {
GET = "GET",
Expand Down
26 changes: 13 additions & 13 deletions src/dsl/interaction.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import {HTTPMethod} from "../common/request";
import {Interaction, RequestOptions} from "./interaction";
import { HTTPMethod } from "../common/request";
import { Interaction, RequestOptions } from "./interaction";

chai.use(chaiAsPromised);
const expect = chai.expect;
Expand All @@ -10,7 +10,7 @@ describe("Interaction", () => {
describe("#given", () => {
it("creates Interaction with provider state", () => {
const actual = new Interaction().given("provider state").json();
expect(actual).to.eql({providerState: "provider state"});
expect(actual).to.eql({ providerState: "provider state" });
});

describe("without provider state", () => {
Expand All @@ -34,7 +34,7 @@ describe("Interaction", () => {

it("has a state with description", () => {
interaction.uponReceiving("an interaction description");
expect(interaction.json()).to.eql({description: "an interaction description"});
expect(interaction.json()).to.eql({ description: "an interaction description" });
});
});

Expand All @@ -46,17 +46,17 @@ describe("Interaction", () => {
});

it("throws error when method is not provided", () => {
expect(interaction.withRequest.bind(interaction, {ath: "/"}))
expect(interaction.withRequest.bind(interaction, { ath: "/" }))
.to.throw(Error, "You must provide a HTTP method.");
});

it("throws error when path is not provided", () => {
expect(interaction.withRequest.bind(interaction, {method: HTTPMethod.GET}))
expect(interaction.withRequest.bind(interaction, { method: HTTPMethod.GET }))
.to.throw(Error, "You must provide a path.");
});

describe("with only mandatory params", () => {
const actual = new Interaction().withRequest({method: HTTPMethod.GET, path: "/search"}).json();
const actual = new Interaction().withRequest({ method: HTTPMethod.GET, path: "/search" }).json();

it("has a state containing only the given keys", () => {
expect(actual).to.have.keys("request");
Expand All @@ -70,8 +70,8 @@ describe("Interaction", () => {

describe("with all other parameters", () => {
const actual = new Interaction().withRequest({
body: {id: 1, name: "Test", due: "tomorrow"},
headers: {"Content-Type": "application/json"},
body: { id: 1, name: "Test", due: "tomorrow" },
headers: { "Content-Type": "application/json" },
method: HTTPMethod.GET,
path: "/search",
query: "q=test",
Expand All @@ -92,13 +92,13 @@ describe("Interaction", () => {
});

it("throws error when status is blank", () => {
expect(interaction.willRespondWith.bind(interaction, {status: ""}))
expect(interaction.willRespondWith.bind(interaction, { status: "" }))
.to.throw(Error, "You must provide a status code.");
});

describe("with only mandatory params", () => {
interaction = new Interaction();
interaction.willRespondWith({status: 200});
interaction.willRespondWith({ status: 200 });
const actual = interaction.json();

it("has a state compacted with only present keys", () => {
Expand All @@ -114,8 +114,8 @@ describe("Interaction", () => {
describe("with all other parameters", () => {
interaction = new Interaction();
interaction.willRespondWith({
body: {id: 1, name: "Test", due: "tomorrow"},
headers: {"Content-Type": "application/json"},
body: { id: 1, name: "Test", due: "tomorrow" },
headers: { "Content-Type": "application/json" },
status: 404,
});

Expand Down
6 changes: 3 additions & 3 deletions src/dsl/interaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* @module Interaction
*/

import {isNil, keys, omitBy} from "lodash";
import {HTTPMethod} from "../common/request";
import {MatcherResult} from "./matchers";
import { isNil, keys, omitBy } from "lodash";
import { HTTPMethod } from "../common/request";
import { MatcherResult } from "./matchers";

export interface RequestOptions {
method: HTTPMethod;
Expand Down
14 changes: 7 additions & 7 deletions src/dsl/mockService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as nock from "nock";
import {HTTPMethod} from "../common/request";
import {Interaction} from "./interaction";
import {MockService} from "./mockService";
import { HTTPMethod } from "../common/request";
import { Interaction } from "./interaction";
import { MockService } from "./mockService";

chai.use(chaiAsPromised);
const expect = chai.expect;
Expand Down Expand Up @@ -53,8 +53,8 @@ describe("MockService", () => {
const interaction = new Interaction();
interaction
.uponReceiving("duh")
.withRequest({method: HTTPMethod.GET, path: "/search"})
.willRespondWith({status: 200});
.withRequest({ method: HTTPMethod.GET, path: "/search" })
.willRespondWith({ status: 200 });

it("when Interaction added successfully", (done) => {
nock(mock.baseUrl).post(/interactions$/).reply(200);
Expand Down Expand Up @@ -104,9 +104,9 @@ describe("MockService", () => {
it("should write the consumer and provider details into the pact", (done) => {
nock(mock.baseUrl)
.post(/pact$/, {
consumer: {name: "aconsumer"},
consumer: { name: "aconsumer" },
pactfile_write_mode: "overwrite",
provider: {name: "aprovider"},
provider: { name: "aprovider" },
})
.reply(200);
expect(mock.writePact()).to.eventually.be.fulfilled.notify(done);
Expand Down
2 changes: 1 addition & 1 deletion src/dsl/mockService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import { isEmpty } from "lodash";
import { logger } from "../common/logger";
import {HTTPMethod, Request} from "../common/request";
import { HTTPMethod, Request } from "../common/request";
import { Interaction } from "./interaction";

export type PactfileWriteMode = "overwrite" | "update" | "merge";
Expand Down
32 changes: 16 additions & 16 deletions src/pact-web.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as sinon from "sinon";
import * as sinonChai from "sinon-chai";
import {HTTPMethod} from "./common/request";
import {Interaction, InteractionObject} from "./dsl/interaction";
import {MockService} from "./dsl/mockService";
import {PactOptions, PactOptionsComplete} from "./dsl/options";
import {PactWeb} from "./pact-web";
import { HTTPMethod } from "./common/request";
import { Interaction, InteractionObject } from "./dsl/interaction";
import { MockService } from "./dsl/mockService";
import { PactOptions, PactOptionsComplete } from "./dsl/options";
import { PactWeb } from "./pact-web";

const expect = chai.expect;
const proxyquire = require("proxyquire").noCallThru();
Expand Down Expand Up @@ -46,13 +46,13 @@ describe("PactWeb", () => {

it("throws Error when consumer not provided", () => {
expect(() => {
new PactWeb({consumer: "", provider: "provider"});
new PactWeb({ consumer: "", provider: "provider" });
}).not.to.throw(Error, "You must specify a Consumer for this pact.");
});

it("throws Error when provider not provided", () => {
expect(() => {
new PactWeb({consumer: "someconsumer", provider: ""});
new PactWeb({ consumer: "someconsumer", provider: "" });
}).not.to.throw(Error, "You must specify a Provider for this pact.");
});
});
Expand All @@ -62,13 +62,13 @@ describe("PactWeb", () => {
state: "i have a list of projects",
uponReceiving: "a request for projects",
withRequest: {
headers: {Accept: "application/json"},
headers: { Accept: "application/json" },
method: HTTPMethod.GET,
path: "/projects",
},
willRespondWith: {
body: {},
headers: {"Content-Type": "application/json"},
headers: { "Content-Type": "application/json" },
status: 200,
},
};
Expand Down Expand Up @@ -111,7 +111,7 @@ describe("PactWeb", () => {

const b = Object.create(PactWeb.prototype) as any as PactWeb;
b.opts = fullOpts;
b.mockService = {verify: verifyStub, removeInteractions: removeInteractionsStub} as any as MockService;
b.mockService = { verify: verifyStub, removeInteractions: removeInteractionsStub } as any as MockService;

const verifyPromise = b.verify();
expect(verifyPromise).to.eventually.eq("removeInteractions");
Expand All @@ -128,7 +128,7 @@ describe("PactWeb", () => {

const b = Object.create(PactWeb.prototype) as any as PactWeb;
b.opts = fullOpts;
b.mockService = {verify: verifyStub, removeInteractions: removeInteractionsStub} as any as MockService;
b.mockService = { verify: verifyStub, removeInteractions: removeInteractionsStub } as any as MockService;

const verifyPromise = b.verify();
expect(verifyPromise).to.eventually.be.rejectedWith(Error).notify(done);
Expand All @@ -148,7 +148,7 @@ describe("PactWeb", () => {

const b = Object.create(PactWeb.prototype) as any as PactWeb;
b.opts = fullOpts;
b.mockService = {verify: verifyStub, removeInteractions: removeInteractionsStub} as any as MockService;
b.mockService = { verify: verifyStub, removeInteractions: removeInteractionsStub } as any as MockService;

expect(b.verify()).to.eventually.be.rejectedWith(Error).notify(done);
});
Expand All @@ -165,7 +165,7 @@ describe("PactWeb", () => {

const p = Object.create(PactWeb.prototype) as any as PactWeb;
p.opts = fullOpts;
p.mockService = {writePact: writePactStub, removeInteractions: sandbox.stub()} as any as MockService;
p.mockService = { writePact: writePactStub, removeInteractions: sandbox.stub() } as any as MockService;

const writePactPromise = p.finalize();
expect(writePactPromise).to.eventually.be.fulfilled.notify(done);
Expand All @@ -178,7 +178,7 @@ describe("PactWeb", () => {

const p = Object.create(PactWeb.prototype) as any as PactWeb;
p.opts = fullOpts;
p.mockService = {writePact: writePactStub, removeInteractions: sandbox.stub()} as any as MockService;
p.mockService = { writePact: writePactStub, removeInteractions: sandbox.stub() } as any as MockService;

const writePactPromise = p.finalize();
expect(writePactPromise).to.eventually.be.rejectedWith(Error).notify(done);
Expand All @@ -195,7 +195,7 @@ describe("PactWeb", () => {

const p = Object.create(PactWeb.prototype) as any as PactWeb;
p.opts = fullOpts;
p.mockService = {writePact: writePactStub, removeInteractions: sandbox.stub()} as any as MockService;
p.mockService = { writePact: writePactStub, removeInteractions: sandbox.stub() } as any as MockService;

const writePactPromise = p.writePact();
expect(writePactPromise).to.eventually.eq("pact file written!");
Expand All @@ -215,7 +215,7 @@ describe("PactWeb", () => {

const p = Object.create(PactWeb.prototype) as any as PactWeb;
p.opts = fullOpts;
p.mockService = {removeInteractions: removeInteractionsStub} as any as MockService;
p.mockService = { removeInteractions: removeInteractionsStub } as any as MockService;

const removeInteractionsPromise = p.removeInteractions();
expect(removeInteractionsPromise).to.eventually.eq("interactions removed!");
Expand Down
16 changes: 8 additions & 8 deletions src/pact.integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as path from "path";
import * as superagent from "superagent";
import {HTTPMethod} from "./common/request";
import {Matchers, Pact} from "./pact";
import { HTTPMethod } from "./common/request";
import { Matchers, Pact } from "./pact";

chai.use(chaiAsPromised);
const expect = chai.expect;
const {eachLike, like, term} = Matchers;
const { eachLike, like, term } = Matchers;

describe("Integration", () => {

Expand Down Expand Up @@ -169,8 +169,8 @@ describe("Integration", () => {
name: like("Do the laundry"),
done: like(true),
}, {
min: 4,
}),
min: 4,
}),
}],
},
});
Expand All @@ -180,7 +180,7 @@ describe("Integration", () => {
it("returns the correct body", () => {
const verificationPromise = superagent
.get(`${PROVIDER_URL}/projects`)
.set({Accept: "application/json"})
.set({ Accept: "application/json" })
.then((res: any) => JSON.parse(res.text)[0]);

return expect(verificationPromise).to.eventually.have.property("tasks");
Expand Down Expand Up @@ -280,8 +280,8 @@ describe("Integration", () => {
// TODO: fix this test, not sure what it's trying to do
const verificationPromise =
superagent.get(`${PROVIDER_URL}/projects`)
.set({Accept: "application/json"})
.then(() => superagent.delete(`${PROVIDER_URL}/projects/2`).catch(() => {}))
.set({ Accept: "application/json" })
.then(() => superagent.delete(`${PROVIDER_URL}/projects/2`).catch(() => { }))
.then(() => provider.verify());

return expect(verificationPromise)
Expand Down
Loading

0 comments on commit 9d3bb0b

Please sign in to comment.