add tetId now tests client-view all passed
This commit is contained in:
69
tests/VorgangList.view.test.ts
Normal file
69
tests/VorgangList.view.test.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import { render } from '@testing-library/svelte';
|
||||
import { describe, expect, it } from "vitest";
|
||||
import VorgangsListPage from '../src/routes/(angemeldet)/list/+page.svelte';
|
||||
const testUser = {
|
||||
admin: true,
|
||||
exp: 1757067123,
|
||||
iat: 1757063523,
|
||||
id: "admin",
|
||||
}
|
||||
const testCrimesList = [
|
||||
{
|
||||
name: 'model-A',
|
||||
lastModified: '2025-08-28T09:44:12.453Z',
|
||||
etag: '558f35716f6af953f9bb5d75f6d77e6a',
|
||||
size: 8947140,
|
||||
prefix: '7596e4d5-c51f-482d-a4aa-ff76434305fc',
|
||||
show_button: true
|
||||
},
|
||||
{
|
||||
name: 'model-z',
|
||||
lastModified: '2025-08-28T10:37:20.142Z',
|
||||
etag: '43e3989c32c4682bee407baaf83b6fa0',
|
||||
size: 35788560,
|
||||
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-2",
|
||||
vorgangPIN: "pin-2",
|
||||
vorgangToken: "cb0051bc-5f38-47b8-943c-9352d4d9c984"
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
const baseData = {
|
||||
user: testUser,
|
||||
vorgang: testVorgangsList[0],
|
||||
vorgangList: testVorgangsList,
|
||||
crimesList: testCrimesList,
|
||||
url: URL,
|
||||
crimeNames: [ "modell-A" ],
|
||||
|
||||
}
|
||||
|
||||
describe('Vorgänge Liste Page', ()=>{
|
||||
//Hier steht die funktion die getestet wird
|
||||
it('zeigt EmptyList-Komponente, wenn Liste leer ist', () => {
|
||||
const testData = { ...baseData, vorgangList: [] };
|
||||
const { getByTestId } = render(VorgangsListPage, {props:{data: testData}});
|
||||
|
||||
expect(getByTestId('empty-list')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('zeigt EmptyList-Komponente, wenn Liste vorhanden ist', () => {
|
||||
const testData = { ...baseData };
|
||||
const { getAllByTestId } = render(VorgangsListPage, {props:{data: testData}});
|
||||
const items = getAllByTestId('test-list-item');
|
||||
|
||||
expect(items).toHaveLength(2); // z. B. bei 2 Einträgen, da fake 2 Einträge hat
|
||||
});
|
||||
})
|
||||
Reference in New Issue
Block a user