Skip to content

Commit 4d6c841

Browse files
committed
Move out interface definitions
1 parent d6b6702 commit 4d6c841

2 files changed

Lines changed: 22 additions & 18 deletions

File tree

test/unit.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
import { assert } from "chai";
22
import Postcode from "../lib/index";
3-
import { loadFixtures, TestCase } from "./util/helper";
4-
5-
type Method =
6-
| "normalise"
7-
| "incode"
8-
| "outcode"
9-
| "area"
10-
| "district"
11-
| "unit"
12-
| "sector"
13-
| "subDistrict";
14-
15-
interface TestMethodOptions {
16-
tests: TestCase[];
17-
method: Method;
18-
}
19-
20-
const testMethod = (options: TestMethodOptions): void => {
3+
import { loadFixtures, TestMethod } from "./util/helper";
4+
5+
const testMethod: TestMethod = options => {
216
const { tests, method } = options;
227
tests.forEach(({ base, expected }) => {
238
const p = new Postcode(base);

test/util/helper.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
import { join } from "path";
22
import { readFile } from "fs";
33

4+
type PostcodeMethod =
5+
| "normalise"
6+
| "incode"
7+
| "outcode"
8+
| "area"
9+
| "district"
10+
| "unit"
11+
| "sector"
12+
| "subDistrict";
13+
14+
interface TestMethodOptions {
15+
tests: TestCase[];
16+
method: PostcodeMethod;
17+
}
18+
19+
export interface TestMethod {
20+
(options: TestMethodOptions): void;
21+
}
22+
423
const dataDir = join(__dirname, "../data");
524

625
interface TestFixtures {

0 commit comments

Comments
 (0)