Use bilhej.se domain for dev test user email.
Aligns seeded and test login addresses with production branding while keeping admin@bilhalsning.se for local docker admin seed only. - Change test@bilhalsning.se to test@bilhej.se in dev migration and all tests
This commit is contained in:
parent
75911dfffa
commit
93ece8128a
14 changed files with 60 additions and 60 deletions
|
|
@ -43,7 +43,7 @@ class AdminControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "test@bilhalsning.se", roles = "USER")
|
||||
@WithMockUser(username = "test@bilhej.se", roles = "USER")
|
||||
void shouldReturn403ForNonAdminUser() throws Exception {
|
||||
mockMvc.perform(get("/api/admin/orders"))
|
||||
.andExpect(status().isForbidden());
|
||||
|
|
@ -52,14 +52,14 @@ class AdminControllerTest {
|
|||
@Test
|
||||
@WithMockUser(username = "admin@bilhalsning.se", roles = "ADMIN")
|
||||
void shouldReturnAllOrdersForAdmin() throws Exception {
|
||||
Order order = createOrder(UUID.randomUUID(), "ABC123", "test@bilhalsning.se", OrderStatus.SENT);
|
||||
Order order = createOrder(UUID.randomUUID(), "ABC123", "test@bilhej.se", OrderStatus.SENT);
|
||||
when(orderService.getAllOrders()).thenReturn(List.of(order));
|
||||
|
||||
mockMvc.perform(get("/api/admin/orders"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$").isArray())
|
||||
.andExpect(jsonPath("$[0].id").value(order.getId().toString()))
|
||||
.andExpect(jsonPath("$[0].email").value("test@bilhalsning.se"))
|
||||
.andExpect(jsonPath("$[0].email").value("test@bilhej.se"))
|
||||
.andExpect(jsonPath("$[0].plate").value("ABC123"))
|
||||
.andExpect(jsonPath("$[0].letterText").value("Test letter"))
|
||||
.andExpect(jsonPath("$[0].status").value("sent"));
|
||||
|
|
@ -86,7 +86,7 @@ class AdminControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "test@bilhalsning.se", roles = "USER")
|
||||
@WithMockUser(username = "test@bilhej.se", roles = "USER")
|
||||
void shouldReturn403WhenPatchingStatusAsNonAdmin() throws Exception {
|
||||
mockMvc.perform(patch("/api/admin/orders/{id}/status",
|
||||
"c1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11")
|
||||
|
|
@ -99,7 +99,7 @@ class AdminControllerTest {
|
|||
@WithMockUser(username = "admin@bilhalsning.se", roles = "ADMIN")
|
||||
void shouldUpdateOrderStatusSuccessfully() throws Exception {
|
||||
UUID orderId = UUID.fromString("c1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
|
||||
Order order = createOrder(orderId, "ABC123", "test@bilhalsning.se", OrderStatus.PAID);
|
||||
Order order = createOrder(orderId, "ABC123", "test@bilhej.se", OrderStatus.PAID);
|
||||
|
||||
when(orderService.updateOrderStatus(eq(orderId), eq("paid"))).thenReturn(order);
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ class AdminControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "test@bilhalsning.se", roles = "USER")
|
||||
@WithMockUser(username = "test@bilhej.se", roles = "USER")
|
||||
void shouldReturn403WhenPatchingTrackingAsNonAdmin() throws Exception {
|
||||
mockMvc.perform(patch("/api/admin/orders/{id}",
|
||||
"c1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11")
|
||||
|
|
@ -167,7 +167,7 @@ class AdminControllerTest {
|
|||
@WithMockUser(username = "admin@bilhalsning.se", roles = "ADMIN")
|
||||
void shouldUpdateTrackingSuccessfully() throws Exception {
|
||||
UUID orderId = UUID.fromString("c1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
|
||||
Order order = createOrder(orderId, "ABC123", "test@bilhalsning.se", OrderStatus.SENT);
|
||||
Order order = createOrder(orderId, "ABC123", "test@bilhej.se", OrderStatus.SENT);
|
||||
order.setTrackingId("PN123456789");
|
||||
|
||||
when(orderService.updateTracking(eq(orderId), eq("PN123456789"))).thenReturn(order);
|
||||
|
|
@ -184,7 +184,7 @@ class AdminControllerTest {
|
|||
@WithMockUser(username = "admin@bilhalsning.se", roles = "ADMIN")
|
||||
void shouldClearTrackingWhenNull() throws Exception {
|
||||
UUID orderId = UUID.fromString("c1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
|
||||
Order order = createOrder(orderId, "ABC123", "test@bilhalsning.se", OrderStatus.SENT);
|
||||
Order order = createOrder(orderId, "ABC123", "test@bilhej.se", OrderStatus.SENT);
|
||||
order.setTrackingId(null);
|
||||
|
||||
when(orderService.updateTracking(eq(orderId), eq(null))).thenReturn(order);
|
||||
|
|
|
|||
|
|
@ -42,14 +42,14 @@ class OrderControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "test@bilhalsning.se")
|
||||
@WithMockUser(username = "test@bilhej.se")
|
||||
void shouldReturnOrdersForAuthenticatedUser() throws Exception {
|
||||
UUID userId = UUID.fromString("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
|
||||
User user = new User();
|
||||
user.setId(userId);
|
||||
user.setEmail("test@bilhalsning.se");
|
||||
user.setEmail("test@bilhej.se");
|
||||
|
||||
when(userService.findByEmail("test@bilhalsning.se")).thenReturn(Optional.of(user));
|
||||
when(userService.findByEmail("test@bilhej.se")).thenReturn(Optional.of(user));
|
||||
|
||||
when(orderService.getOrdersByUserId(userId)).thenReturn(List.of());
|
||||
|
||||
|
|
@ -60,14 +60,14 @@ class OrderControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "test@bilhalsning.se")
|
||||
@WithMockUser(username = "test@bilhej.se")
|
||||
void shouldReturnOrderWithAllFields() throws Exception {
|
||||
UUID userId = UUID.fromString("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
|
||||
User user = new User();
|
||||
user.setId(userId);
|
||||
user.setEmail("test@bilhalsning.se");
|
||||
user.setEmail("test@bilhej.se");
|
||||
|
||||
when(userService.findByEmail("test@bilhalsning.se")).thenReturn(Optional.of(user));
|
||||
when(userService.findByEmail("test@bilhej.se")).thenReturn(Optional.of(user));
|
||||
|
||||
se.bilhalsning.entity.Order order = new se.bilhalsning.entity.Order();
|
||||
order.setId(UUID.fromString("c1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11"));
|
||||
|
|
@ -106,14 +106,14 @@ class OrderControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "test@bilhalsning.se")
|
||||
@WithMockUser(username = "test@bilhej.se")
|
||||
void shouldCreateOrderSuccessfully() throws Exception {
|
||||
UUID userId = UUID.fromString("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
|
||||
User user = new User();
|
||||
user.setId(userId);
|
||||
user.setEmail("test@bilhalsning.se");
|
||||
user.setEmail("test@bilhej.se");
|
||||
|
||||
when(userService.findByEmail("test@bilhalsning.se")).thenReturn(Optional.of(user));
|
||||
when(userService.findByEmail("test@bilhej.se")).thenReturn(Optional.of(user));
|
||||
|
||||
se.bilhalsning.entity.Order savedOrder = new se.bilhalsning.entity.Order();
|
||||
savedOrder.setId(UUID.fromString("d1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11"));
|
||||
|
|
@ -136,7 +136,7 @@ class OrderControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "test@bilhalsning.se")
|
||||
@WithMockUser(username = "test@bilhej.se")
|
||||
void shouldRejectInvalidPlateFormat() throws Exception {
|
||||
mockMvc.perform(post("/api/orders")
|
||||
.contentType("application/json")
|
||||
|
|
@ -146,7 +146,7 @@ class OrderControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "test@bilhalsning.se")
|
||||
@WithMockUser(username = "test@bilhej.se")
|
||||
void shouldRejectEmptyLetterText() throws Exception {
|
||||
mockMvc.perform(post("/api/orders")
|
||||
.contentType("application/json")
|
||||
|
|
@ -155,7 +155,7 @@ class OrderControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "test@bilhalsning.se")
|
||||
@WithMockUser(username = "test@bilhej.se")
|
||||
void shouldRejectLetterTextOver1000Chars() throws Exception {
|
||||
String longText = "a".repeat(1001);
|
||||
mockMvc.perform(post("/api/orders")
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class PaymentControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "test@bilhalsning.se")
|
||||
@WithMockUser(username = "test@bilhej.se")
|
||||
void shouldConfirmPaymentSuccessfully() throws Exception {
|
||||
UUID orderId = UUID.fromString("c1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
|
||||
Order order = new Order();
|
||||
|
|
@ -57,7 +57,7 @@ class PaymentControllerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "test@bilhalsning.se")
|
||||
@WithMockUser(username = "test@bilhej.se")
|
||||
void shouldReturn404WhenOrderNotFound() throws Exception {
|
||||
UUID orderId = UUID.fromString("c1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
|
||||
when(orderService.confirmPayment(eq(orderId)))
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ test.describe('Admin dashboard', () => {
|
|||
test('non-admin user is redirected away from admin', async ({ page }) => {
|
||||
await page.evaluate(() => localStorage.clear())
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ test.describe('Compose flow', () => {
|
|||
|
||||
test('shows error when no plate is provided', async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
@ -21,7 +21,7 @@ test.describe('Compose flow', () => {
|
|||
|
||||
test('displays plate and textarea', async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
@ -37,7 +37,7 @@ test.describe('Compose flow', () => {
|
|||
|
||||
test('submit button disabled when textarea is empty', async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
@ -50,7 +50,7 @@ test.describe('Compose flow', () => {
|
|||
|
||||
test('can create order and navigate to payment page', async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
@ -69,7 +69,7 @@ test.describe('Compose flow', () => {
|
|||
|
||||
test('preview shows letter content and GDPR footer', async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
@ -86,7 +86,7 @@ test.describe('Compose flow', () => {
|
|||
|
||||
test('Visa mallar button opens template picker', async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
@ -104,7 +104,7 @@ test.describe('Compose flow', () => {
|
|||
page,
|
||||
}) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ test.describe('Deferred payment and admin lookup', () => {
|
|||
|
||||
async function loginAsTestUser(page: import('@playwright/test').Page) {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ test.describe('Header auth state', () => {
|
|||
})
|
||||
|
||||
test('shows email and logout when authenticated', async ({ page }) => {
|
||||
const jwt = makeJwt({ sub: 'test@bilhalsning.se', role: 'user' })
|
||||
const jwt = makeJwt({ sub: 'test@bilhej.se', role: 'user' })
|
||||
await page.goto('/')
|
||||
await page.evaluate(
|
||||
(token) => localStorage.setItem('auth_token', token),
|
||||
|
|
@ -32,14 +32,14 @@ test.describe('Header auth state', () => {
|
|||
await page.goto('/')
|
||||
|
||||
const header = page.locator('header')
|
||||
await expect(header.getByText('test@bilhalsning.se')).toBeVisible()
|
||||
await expect(header.getByText('test@bilhej.se')).toBeVisible()
|
||||
await expect(
|
||||
header.getByRole('button', { name: 'Logga ut' }),
|
||||
).toBeVisible()
|
||||
})
|
||||
|
||||
test('shows orders link when authenticated', async ({ page }) => {
|
||||
const jwt = makeJwt({ sub: 'test@bilhalsning.se', role: 'user' })
|
||||
const jwt = makeJwt({ sub: 'test@bilhej.se', role: 'user' })
|
||||
await page.goto('/')
|
||||
await page.evaluate(
|
||||
(token) => localStorage.setItem('auth_token', token),
|
||||
|
|
@ -58,7 +58,7 @@ test.describe('Header auth state', () => {
|
|||
test('hides login and register links when authenticated', async ({
|
||||
page,
|
||||
}) => {
|
||||
const jwt = makeJwt({ sub: 'test@bilhalsning.se', role: 'user' })
|
||||
const jwt = makeJwt({ sub: 'test@bilhej.se', role: 'user' })
|
||||
await page.goto('/')
|
||||
await page.evaluate(
|
||||
(token) => localStorage.setItem('auth_token', token),
|
||||
|
|
@ -76,7 +76,7 @@ test.describe('Header auth state', () => {
|
|||
})
|
||||
|
||||
test('logout restores login and register links', async ({ page }) => {
|
||||
const jwt = makeJwt({ sub: 'test@bilhalsning.se', role: 'user' })
|
||||
const jwt = makeJwt({ sub: 'test@bilhej.se', role: 'user' })
|
||||
await page.goto('/')
|
||||
await page.evaluate(
|
||||
(token) => localStorage.setItem('auth_token', token),
|
||||
|
|
@ -96,11 +96,11 @@ test.describe('Header auth state', () => {
|
|||
await expect(
|
||||
header.getByRole('button', { name: 'Logga ut' }),
|
||||
).not.toBeVisible()
|
||||
await expect(header.getByText('test@bilhalsning.se')).not.toBeVisible()
|
||||
await expect(header.getByText('test@bilhej.se')).not.toBeVisible()
|
||||
})
|
||||
|
||||
test('logout redirects to home page', async ({ page }) => {
|
||||
const jwt = makeJwt({ sub: 'test@bilhalsning.se', role: 'user' })
|
||||
const jwt = makeJwt({ sub: 'test@bilhej.se', role: 'user' })
|
||||
await page.goto('/orders')
|
||||
await page.evaluate(
|
||||
(token) => localStorage.setItem('auth_token', token),
|
||||
|
|
@ -130,7 +130,7 @@ test.describe('Header auth state', () => {
|
|||
})
|
||||
|
||||
test('does not show admin link for regular user', async ({ page }) => {
|
||||
const jwt = makeJwt({ sub: 'test@bilhalsning.se', role: 'user' })
|
||||
const jwt = makeJwt({ sub: 'test@bilhej.se', role: 'user' })
|
||||
await page.goto('/')
|
||||
await page.evaluate(
|
||||
(token) => localStorage.setItem('auth_token', token),
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ test.describe('Login page', () => {
|
|||
|
||||
test('redirects to home after successful login', async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ test.describe('Order history', () => {
|
|||
page,
|
||||
}) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
@ -27,7 +27,7 @@ test.describe('Order history', () => {
|
|||
|
||||
test('displays page heading and seeded orders', async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
@ -42,7 +42,7 @@ test.describe('Order history', () => {
|
|||
|
||||
test('shows correct status badges', async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
@ -58,7 +58,7 @@ test.describe('Order history', () => {
|
|||
page,
|
||||
}) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
@ -76,7 +76,7 @@ test.describe('Order history', () => {
|
|||
|
||||
test('shows tracking links for orders with tracking ID', async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { test, expect } from '@playwright/test'
|
|||
test.describe('Payment redirect', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ test.describe('Vehicle lookup', () => {
|
|||
|
||||
test('CTA navigates to compose when authenticated', async ({ page }) => {
|
||||
await page.goto('/logga-in')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhalsning.se')
|
||||
await page.getByLabel('E-postadress').fill('test@bilhej.se')
|
||||
await page.getByLabel('Lösenord').fill('test1234')
|
||||
await page.getByRole('button', { name: 'Logga in' }).click()
|
||||
await page.waitForURL('/')
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ function mountPage() {
|
|||
const mockOrders = [
|
||||
{
|
||||
id: 'c1eebc99-9c0b-4ef8-bb6d-6bb9bd380a11',
|
||||
email: 'test@bilhalsning.se',
|
||||
email: 'test@bilhej.se',
|
||||
plate: 'ABC123',
|
||||
letterText: 'Hej fin bil!',
|
||||
status: 'sent',
|
||||
|
|
@ -111,7 +111,7 @@ describe('AdminDashboard', () => {
|
|||
it('renders order data in rows', async () => {
|
||||
const { wrapper } = mountPage()
|
||||
await new Promise((r) => setTimeout(r, 50))
|
||||
expect(wrapper.text()).toContain('test@bilhalsning.se')
|
||||
expect(wrapper.text()).toContain('test@bilhej.se')
|
||||
expect(wrapper.text()).toContain('ABC123')
|
||||
expect(wrapper.text()).toContain('user@example.com')
|
||||
expect(wrapper.text()).toContain('XYZ789')
|
||||
|
|
@ -350,7 +350,7 @@ describe('AdminDashboard', () => {
|
|||
await new Promise((r) => setTimeout(r, 50))
|
||||
|
||||
expect(wrapper.text()).toContain('pending@example.com')
|
||||
expect(wrapper.text()).not.toContain('test@bilhalsning.se')
|
||||
expect(wrapper.text()).not.toContain('test@bilhej.se')
|
||||
expect(wrapper.text()).not.toContain('user@example.com')
|
||||
})
|
||||
|
||||
|
|
@ -362,7 +362,7 @@ describe('AdminDashboard', () => {
|
|||
await new Promise((r) => setTimeout(r, 50))
|
||||
|
||||
expect(wrapper.text()).toContain('user@example.com')
|
||||
expect(wrapper.text()).not.toContain('test@bilhalsning.se')
|
||||
expect(wrapper.text()).not.toContain('test@bilhej.se')
|
||||
expect(wrapper.text()).not.toContain('pending@example.com')
|
||||
})
|
||||
|
||||
|
|
@ -373,7 +373,7 @@ describe('AdminDashboard', () => {
|
|||
await wrapper.find('#admin-order-search').setValue('abc123')
|
||||
await new Promise((r) => setTimeout(r, 50))
|
||||
|
||||
expect(wrapper.text()).toContain('test@bilhalsning.se')
|
||||
expect(wrapper.text()).toContain('test@bilhej.se')
|
||||
expect(wrapper.text()).not.toContain('user@example.com')
|
||||
expect(wrapper.text()).not.toContain('pending@example.com')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ describe('AppHeader', () => {
|
|||
|
||||
describe('when authenticated', () => {
|
||||
function mountAuthenticated(role = 'user') {
|
||||
const jwt = makeJwt({ sub: 'test@bilhalsning.se', role })
|
||||
const jwt = makeJwt({ sub: 'test@bilhej.se', role })
|
||||
localStorage.setItem('auth_token', jwt)
|
||||
const pinia = createPinia()
|
||||
setActivePinia(pinia)
|
||||
|
|
@ -132,7 +132,7 @@ describe('AppHeader', () => {
|
|||
|
||||
it('shows user email', () => {
|
||||
const { wrapper } = mountAuthenticated()
|
||||
expect(wrapper.text()).toContain('test@bilhalsning.se')
|
||||
expect(wrapper.text()).toContain('test@bilhej.se')
|
||||
})
|
||||
|
||||
it('shows logout button', () => {
|
||||
|
|
|
|||
|
|
@ -181,15 +181,15 @@ describe('authStore', () => {
|
|||
})
|
||||
|
||||
it('extracts email from JWT sub claim', async () => {
|
||||
const jwt = makeJwt({ sub: 'test@bilhalsning.se', role: 'user' })
|
||||
const jwt = makeJwt({ sub: 'test@bilhej.se', role: 'user' })
|
||||
vi.mocked(globalThis.fetch).mockResolvedValue(
|
||||
mockFetchResponse(200, { token: jwt }),
|
||||
)
|
||||
const store = useAuthStore()
|
||||
|
||||
await store.loginUser('test@bilhalsning.se', 'test1234')
|
||||
await store.loginUser('test@bilhej.se', 'test1234')
|
||||
|
||||
expect(store.email).toBe('test@bilhalsning.se')
|
||||
expect(store.email).toBe('test@bilhej.se')
|
||||
})
|
||||
|
||||
it('returns null email when not authenticated', () => {
|
||||
|
|
@ -198,14 +198,14 @@ describe('authStore', () => {
|
|||
})
|
||||
|
||||
it('clears email on logout', async () => {
|
||||
const jwt = makeJwt({ sub: 'test@bilhalsning.se', role: 'user' })
|
||||
const jwt = makeJwt({ sub: 'test@bilhej.se', role: 'user' })
|
||||
vi.mocked(globalThis.fetch).mockResolvedValue(
|
||||
mockFetchResponse(200, { token: jwt }),
|
||||
)
|
||||
const store = useAuthStore()
|
||||
|
||||
await store.loginUser('test@bilhalsning.se', 'test1234')
|
||||
expect(store.email).toBe('test@bilhalsning.se')
|
||||
await store.loginUser('test@bilhej.se', 'test1234')
|
||||
expect(store.email).toBe('test@bilhej.se')
|
||||
|
||||
store.logout()
|
||||
expect(store.email).toBeNull()
|
||||
|
|
|
|||
Loading…
Reference in a new issue