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