Skip to content

Commit 7bd6570

Browse files
committed
Fix tests
1 parent b68d765 commit 7bd6570

7 files changed

Lines changed: 16 additions & 53 deletions

File tree

test/config.unit.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,6 @@ describe("Config", () => {
1313
process.env = ENV;
1414
});
1515

16-
describe("SERVE_STATIC_ASSET", () => {
17-
it("enables serveStaticAssets", () => {
18-
process.env["SERVE_STATIC_ASSETS"] = "true";
19-
assert.isTrue(configFactory().serveStaticAssets);
20-
});
21-
22-
it("disables serveStaticAssets", () => {
23-
process.env["SERVE_STATIC_ASSETS"] = "false";
24-
assert.isFalse(configFactory().serveStaticAssets);
25-
});
26-
27-
it("defaults to true for unknown input", () => {
28-
process.env["SERVE_STATIC_ASSETS"] = "foo";
29-
assert.isTrue(configFactory().serveStaticAssets);
30-
});
31-
});
32-
3316
describe("HTTP_HEADERS", () => {
3417
it("is undefined by default", () => {
3518
assert.isUndefined(configFactory().httpHeaders);

test/helper/attribute_base.suite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Relation, query } from "../../src/app/models/base";
1+
import { Relation, query } from "../../api/app/models/base";
22
import { assert } from "chai";
33

44
const getCount = (o: any) => Object.keys(o).length;

test/helper/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { join } from "path";
2-
import { generateMethods, query } from "../../src/app/models/base";
3-
import { getConfig as configFactory } from "../../src/config/config";
2+
import { generateMethods, query } from "../../api/app/models/base";
3+
import { getConfig as configFactory } from "../../api/config/config";
44
import * as AttributeBaseSuite from "./attribute_base.suite";
5-
import * as Base from "../../src/app/models/base";
6-
import { Postcode } from "../../src/app/models/postcode";
5+
import * as Base from "../../api/app/models/base";
6+
import { Postcode } from "../../api/app/models/postcode";
77
import removeDiacritics from "./remove_diacritics";
88

9-
import { unaccent } from "../../src/app/lib/unaccent";
10-
import * as errors from "../../src/app/lib/errors";
11-
import * as string from "../../src/app/lib/string";
12-
import * as timeout from "../../src/app/lib/timeout";
9+
import { unaccent } from "../../api/app/lib/unaccent";
10+
import * as errors from "../../api/app/lib/errors";
11+
import * as string from "../../api/app/lib/string";
12+
import * as timeout from "../../api/app/lib/timeout";
1313

14-
import app from "../../src/app";
14+
import app from "../../api/app";
1515

1616
const config = configFactory();
1717

@@ -164,7 +164,7 @@ export * from "./type_checking";
164164
// PG helper methods
165165
export * from "./pg";
166166
//Models
167-
export * from "../../src/app/models/index";
167+
export * from "../../api/app/models/index";
168168

169169
export {
170170
// Data

test/helper/pg.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* PG helper methods
33
*/
4-
import * as Base from "../../src/app/models/base";
4+
import * as Base from "../../api/app/models/base";
55

66
const query = Base.query;
77

test/helper/setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
Lsoa,
1818
Msoa,
1919
PoliceForceArea,
20-
} from "../../src/app/models/index";
20+
} from "../../api/app/models/index";
2121
import { QueryResult } from "pg";
2222

2323
const NO_RELOAD_DB = !!process.env.NO_RELOAD_DB;

test/helper/type_checking.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Postcode, TerminatedPostcode } from "../../src/app/models/index";
1+
import { Postcode, TerminatedPostcode } from "../../api/app/models/index";
22
import { assert } from "chai";
33

44
// Retrieve object size

test/integration.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ describe("Pages routes", () => {
1111
});
1212

1313
describe("/docs", () => {
14-
it("should return 200", async () => {
14+
it("should return 301", async () => {
1515
await request(app)
1616
.get("/docs")
1717
.expect("Content-Type", /html/)
18-
.expect(200);
18+
.expect(301);
1919
});
2020
});
2121
});
@@ -31,11 +31,6 @@ describe("Errors", () => {
3131
});
3232
});
3333

34-
describe("Misc", () => {
35-
it("should return a favicon", async () => {
36-
await request(app).get("/favicon.ico").expect(200);
37-
});
38-
});
3934

4035
describe("Utils", () => {
4136
describe("Health", () => {
@@ -58,21 +53,6 @@ describe("Utils", () => {
5853
});
5954
});
6055

61-
describe("Serve static assets", () => {
62-
it("serves public/ when enabled", async () => {
63-
const config = configFactory();
64-
config.serveStaticAssets = true;
65-
const newApp = postcodesioApplication(config);
66-
await request(newApp).get("/js/app.js").expect(200);
67-
});
68-
it("does not serve public/ when disabled", async () => {
69-
const config = configFactory();
70-
config.serveStaticAssets = false;
71-
const newApp = postcodesioApplication(config);
72-
const response = await request(newApp).get("/js/app.ts").expect(404);
73-
});
74-
});
75-
7656
describe("httpHeaders", () => {
7757
it("sets arbitrary headers on all HTTP responses", async () => {
7858
const config = configFactory();

0 commit comments

Comments
 (0)