Fix jwt-token

This commit is contained in:
2025-09-15 15:11:13 +02:00
parent 039edb5928
commit 9b5a45fa63

View File

@@ -23,7 +23,7 @@ describe('Models', () => {
const userData = { const userData = {
username: 'testuser', username: 'testuser',
email: 'test@example.com', email: 'test@example.com',
password: 'hashedpassword', password_hash: 'hashedpassword',
role: 'admin', role: 'admin',
tenant_id: tenant.id tenant_id: tenant.id
}; };
@@ -42,7 +42,7 @@ describe('Models', () => {
const userData = { const userData = {
username: 'testuser', username: 'testuser',
email: 'test@example.com', email: 'test@example.com',
password: 'hashedpassword', password_hash: 'hashedpassword',
tenant_id: tenant.id tenant_id: tenant.id
}; };
@@ -67,14 +67,14 @@ describe('Models', () => {
const user1 = await models.User.create({ const user1 = await models.User.create({
username: 'testuser', username: 'testuser',
email: 'test1@example.com', email: 'test1@example.com',
password: 'hashedpassword', password_hash: 'hashedpassword',
tenant_id: tenant1.id tenant_id: tenant1.id
}); });
const user2 = await models.User.create({ const user2 = await models.User.create({
username: 'testuser', username: 'testuser',
email: 'test2@example.com', email: 'test2@example.com',
password: 'hashedpassword', password_hash: 'hashedpassword',
tenant_id: tenant2.id tenant_id: tenant2.id
}); });
@@ -89,7 +89,7 @@ describe('Models', () => {
await models.User.create({ await models.User.create({
username: 'testuser', username: 'testuser',
email: 'invalid-email', email: 'invalid-email',
password: 'hashedpassword', password_hash: 'hashedpassword',
tenant_id: tenant.id tenant_id: tenant.id
}); });
expect.fail('Should have thrown validation error'); expect.fail('Should have thrown validation error');
@@ -105,7 +105,7 @@ describe('Models', () => {
await models.User.create({ await models.User.create({
username: 'testuser', username: 'testuser',
email: 'test@example.com', email: 'test@example.com',
password: 'hashedpassword', password_hash: 'hashedpassword',
role: 'invalid_role', role: 'invalid_role',
tenant_id: tenant.id tenant_id: tenant.id
}); });
@@ -120,7 +120,7 @@ describe('Models', () => {
const user = await models.User.create({ const user = await models.User.create({
username: 'testuser', username: 'testuser',
email: 'test@example.com', email: 'test@example.com',
password: 'hashedpassword', password_hash: 'hashedpassword',
tenant_id: tenant.id tenant_id: tenant.id
}); });
@@ -135,16 +135,16 @@ describe('Models', () => {
const user = await models.User.create({ const user = await models.User.create({
username: 'testuser', username: 'testuser',
email: 'test@example.com', email: 'test@example.com',
password: 'hashedpassword', password_hash: 'hashedpassword',
tenant_id: tenant.id tenant_id: tenant.id
}); });
const userWithTenant = await models.User.findByPk(user.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).to.exist;
expect(userWithTenant.Tenant.slug).to.equal(tenant.slug); expect(userWithTenant.tenant.slug).to.equal(tenant.slug);
}); });
}); });
@@ -602,7 +602,7 @@ describe('Models', () => {
const user = await models.User.create({ const user = await models.User.create({
username: 'testuser', username: 'testuser',
email: 'test@example.com', email: 'test@example.com',
password: 'hashedpassword', password_hash: 'hashedpassword',
tenant_id: tenant.id tenant_id: tenant.id
}); });