Skip to content

Commit 7cddc6e

Browse files
Add linting
Fix linting issues
1 parent 02b2c02 commit 7cddc6e

File tree

4 files changed

+87
-87
lines changed

4 files changed

+87
-87
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ clean:
1111
.PHONY: build
1212
build:
1313
npm i
14+
npm run lint
1415
npm run build
1516

1617
.PHONY: lint
Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1-
import {IHttpClient} from "../../http";
2-
import {CompanyFilingHistory, CompanyFilingHistoryResource, FilingHistoryItemResource} from "./types";
1+
import { IHttpClient } from "../../http";
2+
import { CompanyFilingHistory, CompanyFilingHistoryResource, FilingHistoryItemResource } from "./types";
33
import Resource from "../resource";
4-
import {CompanyProfile, CompanyProfileResource} from "../company-profile";
4+
import { CompanyProfile, CompanyProfileResource } from "../company-profile";
55
import Mapping from "../../mapping/mapping";
6-
import {CompanyOfficers} from "../company-officers";
6+
import { CompanyOfficers } from "../company-officers";
77

88
/**
99
* https://developer.companieshouse.gov.uk/api/docs/company/company_number/filing-history/getFilingHistoryList.html
1010
**/
1111
export default class CompanyFilingHistoryService {
12-
constructor (private readonly client: IHttpClient) { }
12+
constructor (private readonly client: IHttpClient) { }
1313

14-
/**
14+
/**
1515
* Get the filing history for a company
1616
*
1717
*/
18-
public async getCompanyFilingHistory (number: string, category?: string): Promise<Resource<CompanyFilingHistory>> {
19-
let queryString;
20-
if (category) {
21-
queryString = `?category=${category}`;
22-
}
18+
public async getCompanyFilingHistory (number: string, category?: string): Promise<Resource<CompanyFilingHistory>> {
19+
let queryString;
20+
if (category) {
21+
queryString = `?category=${category}`;
22+
}
2323

24-
let url = `/company/${number}/filing-history`;
24+
let url = `/company/${number}/filing-history`;
2525

26-
if (queryString) {
27-
url = url.concat(queryString);
28-
}
26+
if (queryString) {
27+
url = url.concat(queryString);
28+
}
2929

30-
const resp = await this.client.httpGet(url);
30+
const resp = await this.client.httpGet(url);
3131

32-
const resource: Resource<CompanyFilingHistory> = {
33-
httpStatusCode: resp.status
34-
};
32+
const resource: Resource<CompanyFilingHistory> = {
33+
httpStatusCode: resp.status
34+
};
3535

36-
if (resp.error) {
37-
return resource;
38-
}
36+
if (resp.error) {
37+
return resource;
38+
}
3939

40-
// cast the response body to the expected type
41-
const body = resp.body as CompanyFilingHistoryResource;
40+
// cast the response body to the expected type
41+
const body = resp.body as CompanyFilingHistoryResource;
4242

43-
resource.resource = Mapping.camelCaseKeys<CompanyFilingHistory>(body);
43+
resource.resource = Mapping.camelCaseKeys<CompanyFilingHistory>(body);
4444

45-
return resource;
46-
}
45+
return resource;
46+
}
4747
}
Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,81 @@
11
import chai from "chai";
2-
import {RequestClient} from "../../../src/http";
2+
import { RequestClient } from "../../../src/http";
33
import sinon from "sinon";
44
import CompanyFilingHistoryService from "../../../src/services/company-filing-history/service";
55
import {
6-
CompanyFilingHistoryResource,
7-
FilingHistoryItemResource
6+
CompanyFilingHistoryResource,
7+
FilingHistoryItemResource
88
} from "../../../src/services/company-filing-history/types";
99

1010
const expect = chai.expect;
1111

1212
const requestClient = new RequestClient({ baseUrl: "URL-NOT-USED", oauthToken: "TOKEN-NOT-USED" });
1313

1414
describe("company-filing-history", () => {
15-
beforeEach(() => {
16-
sinon.reset();
17-
sinon.restore();
18-
});
15+
beforeEach(() => {
16+
sinon.reset();
17+
sinon.restore();
18+
});
1919

20-
afterEach(done => {
21-
sinon.reset();
22-
sinon.restore();
23-
done();
24-
});
20+
afterEach(done => {
21+
sinon.reset();
22+
sinon.restore();
23+
done();
24+
});
2525

26-
it("returns an error response on failure", async () => {
27-
const mockGetResponse = {
28-
status: 401,
29-
error: "An error occurred"
30-
};
31-
const mockRequest = sinon.stub(requestClient, "httpGet").resolves(mockGetResponse);
32-
const companyFilingService : CompanyFilingHistoryService = new CompanyFilingHistoryService(requestClient);
33-
const data = await companyFilingService.getCompanyFilingHistory("NUMBER-NOT-IMPORTANT");
26+
it("returns an error response on failure", async () => {
27+
const mockGetResponse = {
28+
status: 401,
29+
error: "An error occurred"
30+
};
31+
const mockRequest = sinon.stub(requestClient, "httpGet").resolves(mockGetResponse);
32+
const companyFilingService : CompanyFilingHistoryService = new CompanyFilingHistoryService(requestClient);
33+
const data = await companyFilingService.getCompanyFilingHistory("NUMBER-NOT-IMPORTANT");
3434

35-
expect(data.httpStatusCode).to.equal(401);
36-
expect(data.resource).to.be.undefined;
37-
});
35+
expect(data.httpStatusCode).to.equal(401);
36+
expect(data.resource).to.be.undefined;
37+
});
3838

39-
it("maps the company filing history data items correctly", async () => {
40-
const mockFilingHistoryItem: FilingHistoryItemResource = {
41-
category: "category",
42-
date: "someDate",
43-
description: "A description",
44-
transaction_id: "transaction id",
45-
type: "a type"
46-
}
47-
const mockResponseBody : CompanyFilingHistoryResource = {
48-
etag: "someEtag",
49-
filing_history_status: "someFilingHistoryStatus",
50-
items: [mockFilingHistoryItem],
51-
items_per_page: 1,
52-
kind: "a kind",
53-
start_index: 0,
54-
total_count: 1
55-
};
39+
it("maps the company filing history data items correctly", async () => {
40+
const mockFilingHistoryItem: FilingHistoryItemResource = {
41+
category: "category",
42+
date: "someDate",
43+
description: "A description",
44+
transaction_id: "transaction id",
45+
type: "a type"
46+
}
47+
const mockResponseBody : CompanyFilingHistoryResource = {
48+
etag: "someEtag",
49+
filing_history_status: "someFilingHistoryStatus",
50+
items: [mockFilingHistoryItem],
51+
items_per_page: 1,
52+
kind: "a kind",
53+
start_index: 0,
54+
total_count: 1
55+
};
5656

57-
const mockGetResponse = {
58-
status: 200,
59-
body: mockResponseBody
60-
};
57+
const mockGetResponse = {
58+
status: 200,
59+
body: mockResponseBody
60+
};
6161

62-
const mockRequest = sinon.stub(requestClient, "httpGet").resolves(mockGetResponse);
63-
const companyFilingHistoryService : CompanyFilingHistoryService = new CompanyFilingHistoryService(requestClient);
64-
const data = await companyFilingHistoryService.getCompanyFilingHistory("123");
62+
const mockRequest = sinon.stub(requestClient, "httpGet").resolves(mockGetResponse);
63+
const companyFilingHistoryService : CompanyFilingHistoryService = new CompanyFilingHistoryService(requestClient);
64+
const data = await companyFilingHistoryService.getCompanyFilingHistory("123");
6565

66-
expect(data.httpStatusCode).to.equal(200);
66+
expect(data.httpStatusCode).to.equal(200);
6767

68-
expect(data.resource.etag).to.equal(mockResponseBody.etag)
69-
expect(data.resource.filingHistoryStatus).to.equal(mockResponseBody.filing_history_status)
70-
expect(data.resource.itemsPerPage).to.equal(mockResponseBody.items_per_page)
71-
expect(data.resource.kind).to.equal(mockResponseBody.kind)
72-
expect(data.resource.startIndex).to.equal(mockResponseBody.start_index)
73-
expect(data.resource.totalCount).to.equal(mockResponseBody.total_count)
68+
expect(data.resource.etag).to.equal(mockResponseBody.etag)
69+
expect(data.resource.filingHistoryStatus).to.equal(mockResponseBody.filing_history_status)
70+
expect(data.resource.itemsPerPage).to.equal(mockResponseBody.items_per_page)
71+
expect(data.resource.kind).to.equal(mockResponseBody.kind)
72+
expect(data.resource.startIndex).to.equal(mockResponseBody.start_index)
73+
expect(data.resource.totalCount).to.equal(mockResponseBody.total_count)
7474

75-
expect(data.resource.items[0].category).to.equal(mockFilingHistoryItem.category);
76-
expect(data.resource.items[0].date).to.equal(mockFilingHistoryItem.date);
77-
expect(data.resource.items[0].description).to.equal(mockFilingHistoryItem.description);
78-
expect(data.resource.items[0].transactionId).to.equal(mockFilingHistoryItem.transaction_id);
79-
expect(data.resource.items[0].type).to.equal(mockFilingHistoryItem.type);
75+
expect(data.resource.items[0].category).to.equal(mockFilingHistoryItem.category);
76+
expect(data.resource.items[0].date).to.equal(mockFilingHistoryItem.date);
77+
expect(data.resource.items[0].description).to.equal(mockFilingHistoryItem.description);
78+
expect(data.resource.items[0].transactionId).to.equal(mockFilingHistoryItem.transaction_id);
79+
expect(data.resource.items[0].type).to.equal(mockFilingHistoryItem.type);
8080
});
8181
});

test/services/refresh-token/service.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ describe("refresh token", () => {
1818
});
1919

2020
it("returns an error response on failure", async () => {
21-
2221
sinon.stub(requestClient, "httpPost").resolves({
2322
status: 400,
2423
error: "Invalid parameter"

0 commit comments

Comments
 (0)