summary refs log tree commit diff
path: root/util/tests/validate.test.js
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-26 02:07:16 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-26 02:07:16 +0200
commitc4426920a113b419c22f27eda347e5a04c108acc (patch)
treee475e8af64c3e6c7e6086c1cc09c3a8daa9046a0 /util/tests/validate.test.js
parent:sparkles: unit test (diff)
downloadserver-c4426920a113b419c22f27eda347e5a04c108acc.tar.xz
:bug: fix unit tests
Diffstat (limited to 'util/tests/validate.test.js')
-rw-r--r--util/tests/validate.test.js25
1 files changed, 13 insertions, 12 deletions
diff --git a/util/tests/validate.test.js b/util/tests/validate.test.js

index d36da1ed..c885a167 100644 --- a/util/tests/validate.test.js +++ b/util/tests/validate.test.js
@@ -1,30 +1,31 @@ const { initDatabase } = require("../dist/util/Database"); const { User } = require("../dist/entities/User"); +jest.setTimeout(10000); -beforeAll(async () => { - await initDatabase(); - new User().validate(); +beforeAll((done) => { + initDatabase().then(() => { + new User().validate(); // warm up schema/model + done(); + }); }); describe("Validate model class properties", () => { - describe("validation should be faster than 20ms", () => { - expect(() => new User().validate()).toBeFasterThan(20); - }); - describe("User", () => { - test("object instead of string", () => { + test("object instead of string", async () => { expect(() => { new User({ username: {} }).validate(); }).toThrow(); }); }); + test("validation should be faster than 20ms", () => { + expect(() => { + new User().validate(); + }).toBeFasterThan(20); + }); + test("should not set opts", () => { const user = new User({ opts: { id: 0 } }); expect(user.opts.id).not.toBe(0); }); - - test("test", () => { - expect(1).toBe(1); - }); });