Conversation
| it('makes a single template request for multiple beacons', async () => { | ||
| const state = stateModule.getInitialState(config); | ||
| jest.spyOn(stateModule, 'getState').mockReturnValue(state); | ||
| const logger = createMockedLogger(); |
There was a problem hiding this comment.
Tip: If you want to know what is actually logged, you can do:
(logger as any).debug.mockImplementation(console.log)which will forward the logs to console log. I used that a bit.
|
|
||
| export const callApi = async (payload: node.ApiCallPayload) => { | ||
| getLogger().debug('Preprocessing API call payload', { aggregateApiCall: payload.aggregatedApiCall }); | ||
| getLogger().debug('Preprocessing API call payload', pick(payload.aggregatedApiCall, ['endpointName', 'oisTitle'])); |
There was a problem hiding this comment.
The example file is uses pre/post processing to only make a single API call and if you log the full aggregateApiCall you also log parameters (of a single beacon) which is confusing, so I only log endpointName and oisTitle.
| getLogger().debug('Preprocessing API call payload', pick(payload.aggregatedApiCall, ['endpointName', 'oisTitle'])); | ||
| const processedPayload = await preProcessApiSpecifications(payload); | ||
| getLogger().debug('Performing API call', { aggregateApiCall: payload.aggregatedApiCall }); | ||
| getLogger().debug('Performing API call', { processedPayload: processedPayload }); |
There was a problem hiding this comment.
This was a bug before - we should have logged the processed payloed.
| getLogger().info(`Pushed signed data updates to the pool.`, { ...logContext, count: goRes.data.count }); | ||
|
|
||
| getLogger().debug('Parsing response from the data registry.', { ...logContext, axiosResponse: goAxiosRequest.data }); | ||
| const parsedResponse = dataRegistryResponseSchema.safeParse(goAxiosRequest.data); |
There was a problem hiding this comment.
This was not handled correctly previously.
| import { initiateFetchingBeaconData } from './fetch-beacon-data'; | ||
| import { initiateUpdatingSignedApi } from './update-signed-api'; | ||
| import { initializeState } from './state'; | ||
| import { initializeWallet } from './wallets'; |
There was a problem hiding this comment.
This broke the tests, since the getInitialState function essentially returned invalid state (wallet was missing).
There was a problem hiding this comment.
I moved all of the fixtures to this file. It makes the tests a bit cleaner and we might use these in case we want to make an e2e test later on.
|
@andreogle I anticipated we will do #45 and renamed some of the variables to data registry for clarity. I need to revert this back to the original naming (that's why I added the WIP). EDIT: The above was done. |
3fc60e6 to
3fecb9b
Compare
3fecb9b to
6cca374
Compare
Closes #25