Skip to content

Commit

Permalink
Wait for candle updates to run before checking for updates
Browse files Browse the repository at this point in the history
  • Loading branch information
adamfraser committed Jul 25, 2024
1 parent 5037908 commit 3903935
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions indexer/services/ender/__tests__/lib/candles-generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,31 +505,32 @@ describe('candleHelper', () => {
]);

// Create new candles, with trades
await runUpdateCandles(publisher);

// Verify previous candles have orderbookMidPriceClose updated
const previousExpectedCandles: CandleFromDatabase[] = _.map(
Object.values(CandleResolution),
(resolution: CandleResolution) => {
return {
id: CandleTable.uuid(previousStartedAt, defaultCandle.ticker, resolution),
startedAt: previousStartedAt,
ticker: defaultCandle.ticker,
resolution,
low: existingPrice,
high: existingPrice,
open: existingPrice,
close: existingPrice,
baseTokenVolume,
usdVolume,
trades: existingTrades,
startingOpenInterest,
orderbookMidPriceClose: '10005',
orderbookMidPriceOpen,
};
},
);
await verifyCandlesInPostgres(previousExpectedCandles);
await runUpdateCandles(publisher).then(async () => {

// Verify previous candles have orderbookMidPriceClose updated
const previousExpectedCandles: CandleFromDatabase[] = _.map(
Object.values(CandleResolution),
(resolution: CandleResolution) => {
return {
id: CandleTable.uuid(previousStartedAt, defaultCandle.ticker, resolution),
startedAt: previousStartedAt,
ticker: defaultCandle.ticker,
resolution,
low: existingPrice,
high: existingPrice,
open: existingPrice,
close: existingPrice,
baseTokenVolume,
usdVolume,
trades: existingTrades,
startingOpenInterest,
orderbookMidPriceClose: '10005',
orderbookMidPriceOpen,
};
},
);
await verifyCandlesInPostgres(previousExpectedCandles);
});

// Verify new candles were created
const expectedCandles: CandleFromDatabase[] = _.map(
Expand Down

0 comments on commit 3903935

Please sign in to comment.