🧪 Improve test readability and formatting in TournamentDetail component unit tests
This commit is contained in:
@@ -161,7 +161,7 @@ describe('TournamentDetail', () => {
|
||||
|
||||
const jsonPre = wrapper.find('.detail-json');
|
||||
expect(jsonPre.exists()).toBe(true);
|
||||
|
||||
|
||||
const jsonText = jsonPre.text();
|
||||
expect(jsonText).toContain('"tournament"');
|
||||
expect(jsonText).toContain('"id"');
|
||||
@@ -180,7 +180,7 @@ describe('TournamentDetail', () => {
|
||||
|
||||
const jsonText = wrapper.find('.detail-json').text();
|
||||
const parsed = JSON.parse(jsonText);
|
||||
|
||||
|
||||
// Verify it's valid JSON and properly formatted
|
||||
expect(parsed).toEqual(mockTournamentDetails);
|
||||
expect(jsonText).toContain(' '); // Contains indentation
|
||||
@@ -193,9 +193,7 @@ describe('TournamentDetail', () => {
|
||||
{ id: 1, name: 'Player 1' },
|
||||
{ id: 2, name: 'Player 2' }
|
||||
],
|
||||
matches: [
|
||||
{ id: 'm1', player1_id: 1, player2_id: 2, state: 'pending' }
|
||||
]
|
||||
matches: [{ id: 'm1', player1_id: 1, player2_id: 2, state: 'pending' }]
|
||||
};
|
||||
|
||||
const wrapper = mount(TournamentDetail, {
|
||||
@@ -236,7 +234,10 @@ describe('TournamentDetail', () => {
|
||||
expect(wrapper.text()).toContain('Test Tournament');
|
||||
|
||||
const newDetails = {
|
||||
tournament: { ...mockTournamentDetails.tournament, name: 'Updated Tournament' }
|
||||
tournament: {
|
||||
...mockTournamentDetails.tournament,
|
||||
name: 'Updated Tournament'
|
||||
}
|
||||
};
|
||||
|
||||
await wrapper.setProps({ tournamentDetails: newDetails });
|
||||
|
||||
Reference in New Issue
Block a user