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-27 11:11:16 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-08-27 11:11:16 +0200
commitc21c3428217d25c058a6fb9fe40bcfdc1cc1e1c1 (patch)
tree67f8265ba004ea5d576311f582c98d8a00676c2f /util/tests/validate.test.js
parent:construction: api (diff)
downloadserver-c21c3428217d25c058a6fb9fe40bcfdc1cc1e1c1.tar.xz
:construction: typeorm
Diffstat (limited to 'util/tests/validate.test.js')
-rw-r--r--util/tests/validate.test.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/util/tests/validate.test.js b/util/tests/validate.test.js
index c885a167..434422f8 100644
--- a/util/tests/validate.test.js
+++ b/util/tests/validate.test.js
@@ -1,4 +1,4 @@
-const { initDatabase } = require("../dist/util/Database");
+const { initDatabase, closeDatabase } = require("../dist/util/Database");
 const { User } = require("../dist/entities/User");
 jest.setTimeout(10000);
 
@@ -9,13 +9,15 @@ beforeAll((done) => {
 	});
 });
 
+afterAll(() => {
+	closeDatabase();
+});
+
 describe("Validate model class properties", () => {
-	describe("User", () => {
-		test("object instead of string", async () => {
-			expect(() => {
-				new User({ username: {} }).validate();
-			}).toThrow();
-		});
+	test("object instead of string", async () => {
+		expect(() => {
+			new User({}, { id: {} }).validate();
+		}).toThrow();
 	});
 
 	test("validation should be faster than 20ms", () => {