Improve auction realtime bid responsiveness
This commit is contained in:
1 parent
c6f5a7077f
commit
b367328df0
16 files changed
+1364
-203
No files matched your search
@@ -41,6 +41,46 @@ describe('AuctionRedisStateReaderService', () => {
|
||||
await expect(service.readLiveStateIdentity('match-1')).resolves.toBeNull();
|
||||
});
|
||||
|
||||
it('reads bid context from the live state hot path fields', async () => {
|
||||
const { service, sendCommand } = makeService([
|
||||
['bidding', 'life-1', 'player-1', 'captain-2'],
|
||||
]);
|
||||
|
||||
await expect(service.readBidContext('match-1', 2)).resolves.toEqual({
|
||||
auctionLifecycleId: 'life-1',
|
||||
bidderTeamCaptainUserId: 'captain-2',
|
||||
currentBidRoundPlayerUserId: 'player-1',
|
||||
phase: 'bidding',
|
||||
});
|
||||
expect(sendCommand).toHaveBeenCalledTimes(1);
|
||||
expect(sendCommand).toHaveBeenCalledWith([
|
||||
'HMGET',
|
||||
'auction:match-1:liveAuctionState',
|
||||
'phase',
|
||||
'auctionLifecycleId',
|
||||
'currentBidRoundPlayerUserId',
|
||||
'team:2:captainUserId',
|
||||
]);
|
||||
});
|
||||
|
||||
it('falls back to structure state when bid context has no live captain field', async () => {
|
||||
const { service, sendCommand } = makeService([
|
||||
['bidding', 'life-1', 'player-1', null],
|
||||
'{"auctionTeams":[{"teamIndex":2,"captainUserId":"captain-2"}]}',
|
||||
]);
|
||||
|
||||
await expect(service.readBidContext('match-1', 2)).resolves.toEqual({
|
||||
auctionLifecycleId: 'life-1',
|
||||
bidderTeamCaptainUserId: 'captain-2',
|
||||
currentBidRoundPlayerUserId: 'player-1',
|
||||
phase: 'bidding',
|
||||
});
|
||||
expect(sendCommand).toHaveBeenNthCalledWith(2, [
|
||||
'GET',
|
||||
'auction:match-1:auctionStructureState',
|
||||
]);
|
||||
});
|
||||
|
||||
it('assembles a public auction view from Redis state', async () => {
|
||||
const { service, sendCommand } = makeService([
|
||||
[
|
||||
|
||||
Reference in new issue
Block a user