add test for geoip

This commit is contained in:
undefined committed 2020-08-29 20:23:59 +08:00
1 parent 7651b0a697
commit a8bdfa8f30
7 files changed
+26 -13

No files matched your search

+1 -1
View File
@@ -55,7 +55,7 @@ export function edit(domainId: string, $set: any) {
return coll.updateOne({ _id: domainId }, { $set });
}
export async function inc(domainId: string, field: any, n: number): Promise<number | null> {
export async function inc(domainId: string, field: keyof DomainDoc, n: number): Promise<number | null> {
const res = await coll.findOneAndUpdate(
{ _id: domainId },
// FIXME
+7 -6
View File
@@ -1,5 +1,4 @@
import 'hydrooj/src/utils';
import 'hydrooj';
jest.mock('hydrooj/src/service/db');
export async function connect() {
@@ -13,8 +12,10 @@ export async function connect() {
export async function dispose() {
const db = require('hydrooj/src/service/db');
await db.getClient().close();
await db.getClient2().close();
await db.getDb().close();
await db.getDb2().close();
await Promise.all([
db.getClient().close(),
db.getClient2().close(),
db.getDb().close(),
db.getDb2().close(),
]);
}
+1 -1
View File
@@ -1,8 +1,8 @@
import 'hydrooj';
import 'hydrooj/src/utils';
import md5 from 'hydrooj/src/lib/md5';
import sha1 from 'hydrooj/src/lib/sha1';
import pwhash from 'hydrooj/src/lib/hash.hydro';
import 'hydrooj/src/utils';
describe('crypto', () => {
const content1 = 'twd2akioi';
+1
View File
@@ -16,6 +16,7 @@
"src"
],
"exclude": [
"__mocks__",
"bin",
"dist"
]