重构
This commit is contained in:
@@ -169,6 +169,97 @@ describe('SettlementCalculator', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Additional score-derived markets', () => {
|
||||
it('settles home and away team total goals', () => {
|
||||
const s = { htHome: 1, htAway: 0, ftHome: 2, ftAway: 1 };
|
||||
expect(
|
||||
settleSelection({
|
||||
marketType: 'FT_TEAM_TOTAL_HOME',
|
||||
selectionCode: 'OVER',
|
||||
totalLine: 1.5,
|
||||
score: s,
|
||||
}),
|
||||
).toBe('WIN');
|
||||
expect(
|
||||
settleSelection({
|
||||
marketType: 'FT_TEAM_TOTAL_AWAY',
|
||||
selectionCode: 'UNDER',
|
||||
totalLine: 1.5,
|
||||
score: s,
|
||||
}),
|
||||
).toBe('WIN');
|
||||
});
|
||||
|
||||
it('settles half time / full time combinations', () => {
|
||||
expect(
|
||||
settleSelection({
|
||||
marketType: 'HT_FT',
|
||||
selectionCode: 'HOME_HOME',
|
||||
score,
|
||||
}),
|
||||
).toBe('WIN');
|
||||
expect(
|
||||
settleSelection({
|
||||
marketType: 'HT_FT',
|
||||
selectionCode: 'DRAW_HOME',
|
||||
score,
|
||||
}),
|
||||
).toBe('LOSE');
|
||||
});
|
||||
|
||||
it('settles total goals ranges', () => {
|
||||
expect(
|
||||
settleSelection({
|
||||
marketType: 'FT_TOTAL_GOALS',
|
||||
selectionCode: 'TG_2_3',
|
||||
score,
|
||||
}),
|
||||
).toBe('WIN');
|
||||
expect(
|
||||
settleSelection({
|
||||
marketType: 'FT_TOTAL_GOALS',
|
||||
selectionCode: 'TG_7_PLUS',
|
||||
score,
|
||||
}),
|
||||
).toBe('LOSE');
|
||||
});
|
||||
|
||||
it('settles corners handicap and totals from match stats', () => {
|
||||
const s = { htHome: 0, htAway: 0, ftHome: 1, ftAway: 1 };
|
||||
const stats = { homeCorners: 7, awayCorners: 4 };
|
||||
expect(
|
||||
settleSelection({
|
||||
marketType: 'FT_CORNERS_HANDICAP',
|
||||
selectionCode: 'HOME',
|
||||
handicapLine: -2.5,
|
||||
score: s,
|
||||
stats,
|
||||
}),
|
||||
).toBe('WIN');
|
||||
expect(
|
||||
settleSelection({
|
||||
marketType: 'FT_CORNERS_OVER_UNDER',
|
||||
selectionCode: 'OVER',
|
||||
totalLine: 10.5,
|
||||
score: s,
|
||||
stats,
|
||||
}),
|
||||
).toBe('WIN');
|
||||
});
|
||||
|
||||
it('settles cards total from match stats', () => {
|
||||
expect(
|
||||
settleSelection({
|
||||
marketType: 'FT_CARDS_OVER_UNDER',
|
||||
selectionCode: 'UNDER',
|
||||
totalLine: 5.5,
|
||||
score,
|
||||
stats: { homeCards: 2, awayCards: 3 },
|
||||
}),
|
||||
).toBe('WIN');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Parlay', () => {
|
||||
it('S016: all win', () => {
|
||||
const result = calculateParlayPayout(100, [
|
||||
|
||||
Reference in New Issue
Block a user