Mike Gerwitz

Activist for User Freedom

path: root/test
diff options
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2019-09-16 13:38:13 -0400
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2019-10-17 11:47:14 -0400
commitfb88ceeae65418fcefeb75b4e49a1aeeaaea3998 (patch)
treeb0fb28eef4a2ee122b9c17b3a40676a7ade80da7 /test
parent37f1b86ac148154448ae75a9930365f563c5688c (diff)
TokenDao: class=>interface
TokenDao has been renamed to MongoTokenDao. While it's good for this to have its own interface anyway, the immediate motivation was for unit tests: I started playing with mocking with TypeScript and researching some libraries, but I don't have time to research enough to commit to any of them at the moment. Interfaces remove the need to mock at all. This also stops using `export default' in favor of just importing by name. Using defaults only saves us a few characters, and it makes for awkward syntax in various cases (e.g. with multiple exports). But I'm still new to TS, so who knows if I'll be flip-flopping on this decision in the future. If we kept to our normal 1:1 file:definition convention, it wouldn't cause problems, but based on the types I've had to define so far, that'd cause way too much bloat and boilerplate. * src/server/daemon/controller.js: No long import `default'. Use `MongoTokenDao'. * src/server/token/TokenedService.js: Stop checking type (since TS interfaces do not result in compiler output, easejs cannot validate against them.) * src/server/token/MongoTokenDao.ts: Rename from `TokenDao.ts'. * src/server/token/TokenDao.ts: Rename from `TokenQueryResult.ts'. (TokenDao): New interface. * src/server/token/TokenQueryResult.ts: Rename to `TokenDao.ts'. * test/server/token/MongoTokenDaoTest.ts: Rename from `TokenDaoTest.ts'.
Diffstat (limited to 'test')
-rw-r--r--test/server/token/MongoTokenDaoTest.ts (renamed from test/server/token/TokenDaoTest.ts)8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/server/token/TokenDaoTest.ts b/test/server/token/MongoTokenDaoTest.ts
index c992632..74f9c13 100644
--- a/test/server/token/TokenDaoTest.ts
+++ b/test/server/token/MongoTokenDaoTest.ts
@@ -20,15 +20,13 @@
import {
+ TokenData,
-} from "../../../src/server/token/TokenQueryResult";
-import {
- default as Sut,
- TokenData,
} from "../../../src/server/token/TokenDao";
+import { MongoTokenDao as Sut } from "../../../src/server/token/MongoTokenDao";
import {