Resolve external opponent TTR ratings and show lookup diagnostics
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 1m0s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 1m0s
This commit is contained in:
@@ -84,3 +84,40 @@ test('standalone test mode calls the API and keeps real pairings without inventi
|
||||
assert.equal(rows[0].homeTtr, null);
|
||||
assert.equal(rows[0].preview, null);
|
||||
});
|
||||
|
||||
test('TTR requests include displayed singles even when legacy lineup metadata is missing', () => {
|
||||
const report = dialog();
|
||||
report.meetingDetails = { teamLineupHomePlayers: [{ firstname: 'Anton', lastname: 'Schottdorf', nuLigaPersonId: 123 }] };
|
||||
const home = report.ttrLineupPlayers('home');
|
||||
assert.equal(home.length, 1);
|
||||
assert.equal(home[0].nuLigaPersonId, 123);
|
||||
const guest = report.ttrLineupPlayers('guest');
|
||||
assert.equal(guest.length, 1);
|
||||
assert.equal(guest[0].name, 'Yumin Kim');
|
||||
});
|
||||
|
||||
test('test mode on a saved report calls the real endpoint and exposes lookup diagnostics', async () => {
|
||||
const report = dialog();
|
||||
Object.assign(report, {
|
||||
standaloneTest: false,
|
||||
isTestMode: true,
|
||||
canOpenTtrPreview: true,
|
||||
match: { id: 42 },
|
||||
meetingDetails: {},
|
||||
meetingData: { homeClub: 'TSV 1875 Bonames', guestClub: 'Eintracht Frankfurt' },
|
||||
});
|
||||
const originalPost = context.apiClient.post;
|
||||
context.apiClient.post = async (url, body) => {
|
||||
assert.equal(url, '/matches/42/ttr-preview');
|
||||
assert.equal(body.homeClubName, 'TSV 1875 Bonames');
|
||||
assert.equal(body.homePlayers[0].name, 'Anton Schottdorf');
|
||||
return { data: { players: [], diagnostics: [{ side: 'home', message: 'Session abgelaufen' }] } };
|
||||
};
|
||||
try {
|
||||
await report.loadTtrPreview();
|
||||
assert.equal(report.ttrDiagnostics[0].message, 'Session abgelaufen');
|
||||
assert.equal(report.ttrLoading, false);
|
||||
} finally {
|
||||
context.apiClient.post = originalPost;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user