formatting

This commit is contained in:
2025-09-23 10:38:59 +02:00
parent 961ed39615
commit 67b027e33f

View File

@@ -1,13 +1,13 @@
import { render } from '@testing-library/svelte';
import { describe, expect, it } from "vitest";
import TatortListPage from "../src/routes/(token-based)/list/[vorgang]/+page.svelte";
import { describe, expect, it } from 'vitest';
import TatortListPage from '../src/routes/(token-based)/list/[vorgang]/+page.svelte';
const testUser = {
admin: true,
exp: 1757067123,
iat: 1757063523,
id: "admin",
}
exp: 1757067123,
iat: 1757063523,
id: 'admin'
};
const testCrimesList = [
{
name: 'model-A',
@@ -25,21 +25,20 @@ const testCrimesList = [
prefix: '7596e4d5-c51f-482d-a4aa-ff76434305fc',
show_button: true
}
];
];
const testVorgangsList = [
{
vorgangName: "vorgang-1",
vorgangPIN: "pin-123",
vorgangToken: "c322f26f-8c5e-4cb9-94b3-b5433bf5109e"
vorgangName: 'vorgang-1',
vorgangPIN: 'pin-123',
vorgangToken: 'c322f26f-8c5e-4cb9-94b3-b5433bf5109e'
},
{
vorgangName: "vorgang-2",
vorgangPIN: "pin-2",
vorgangToken: "cb0051bc-5f38-47b8-943c-9352d4d9c984"
vorgangName: 'vorgang-2',
vorgangPIN: 'pin-2',
vorgangToken: 'cb0051bc-5f38-47b8-943c-9352d4d9c984'
}
]
];
const baseData = {
user: testUser,
@@ -47,25 +46,22 @@ const baseData = {
vorgangList: testVorgangsList,
crimesList: testCrimesList,
url: URL,
crimeNames: [ "modell-A" ],
}
describe('Tatort Liste Page EmptyList-Komponente View', ()=>{
crimeNames: ['modell-A']
};
describe('Tatort Liste Page EmptyList-Komponente View', () => {
it('zeigt EmptyList-Komponente an, wenn Liste leer ist', () => {
const testData = { ...baseData, crimesList: [] };
const { getByTestId } = render(TatortListPage, {props:{data: testData}});
const { getByTestId } = render(TatortListPage, { props: { data: testData } });
expect(getByTestId('empty-list')).toBeInTheDocument();
});
it('zeigt Liste(min. 1 li-Element) an, wenn Liste vorhanden ist', () => {
const testData = { ...baseData };
const { getAllByTestId } = render(TatortListPage, {props:{data: testData}});
const items = getAllByTestId('test-list-item');
const { getAllByTestId } = render(TatortListPage, { props: { data: testData } });
const items = getAllByTestId('test-list-item');
expect(items).toHaveLength(2);
});
})
});