From 9b5a45fa6373f210874a7083ffb874ff1ffb94e1 Mon Sep 17 00:00:00 2001 From: Alexander Borg Date: Mon, 15 Sep 2025 15:11:13 +0200 Subject: [PATCH] Fix jwt-token --- server/tests/models/models.test.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/server/tests/models/models.test.js b/server/tests/models/models.test.js index 0e9f7b1..94be49f 100644 --- a/server/tests/models/models.test.js +++ b/server/tests/models/models.test.js @@ -23,7 +23,7 @@ describe('Models', () => { const userData = { username: 'testuser', email: 'test@example.com', - password: 'hashedpassword', + password_hash: 'hashedpassword', role: 'admin', tenant_id: tenant.id }; @@ -42,7 +42,7 @@ describe('Models', () => { const userData = { username: 'testuser', email: 'test@example.com', - password: 'hashedpassword', + password_hash: 'hashedpassword', tenant_id: tenant.id }; @@ -67,14 +67,14 @@ describe('Models', () => { const user1 = await models.User.create({ username: 'testuser', email: 'test1@example.com', - password: 'hashedpassword', + password_hash: 'hashedpassword', tenant_id: tenant1.id }); const user2 = await models.User.create({ username: 'testuser', email: 'test2@example.com', - password: 'hashedpassword', + password_hash: 'hashedpassword', tenant_id: tenant2.id }); @@ -89,7 +89,7 @@ describe('Models', () => { await models.User.create({ username: 'testuser', email: 'invalid-email', - password: 'hashedpassword', + password_hash: 'hashedpassword', tenant_id: tenant.id }); expect.fail('Should have thrown validation error'); @@ -105,7 +105,7 @@ describe('Models', () => { await models.User.create({ username: 'testuser', email: 'test@example.com', - password: 'hashedpassword', + password_hash: 'hashedpassword', role: 'invalid_role', tenant_id: tenant.id }); @@ -120,7 +120,7 @@ describe('Models', () => { const user = await models.User.create({ username: 'testuser', email: 'test@example.com', - password: 'hashedpassword', + password_hash: 'hashedpassword', tenant_id: tenant.id }); @@ -135,16 +135,16 @@ describe('Models', () => { const user = await models.User.create({ username: 'testuser', email: 'test@example.com', - password: 'hashedpassword', + password_hash: 'hashedpassword', tenant_id: tenant.id }); const userWithTenant = await models.User.findByPk(user.id, { - include: [models.Tenant] + include: [{ model: models.Tenant, as: 'tenant' }] }); - expect(userWithTenant.Tenant).to.exist; - expect(userWithTenant.Tenant.slug).to.equal(tenant.slug); + expect(userWithTenant.tenant).to.exist; + expect(userWithTenant.tenant.slug).to.equal(tenant.slug); }); }); @@ -602,7 +602,7 @@ describe('Models', () => { const user = await models.User.create({ username: 'testuser', email: 'test@example.com', - password: 'hashedpassword', + password_hash: 'hashedpassword', tenant_id: tenant.id });