Skip to content

Commit 59a1f37

Browse files
authored
Market-status composite defaults to unknown status (#3484)
1 parent fff0c6c commit 59a1f37

File tree

4 files changed

+14
-67
lines changed

4 files changed

+14
-67
lines changed

.changeset/poor-roses-brake.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@chainlink/market-status-adapter': minor
3+
---
4+
5+
Default to unknown status instead of closed

packages/composites/market-status/src/transport/market-status.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ export class MarketStatusTransport extends SubscriptionTransport<BaseEndpointTyp
9898
}
9999

100100
logger.error(
101-
`Secondary adapter ${adapterNames.secondary} for market ${market} returned unknown market status, defaulting to CLOSED`,
101+
`Secondary adapter ${adapterNames.secondary} for market ${market} returned unknown market status, defaulting to UNKNOWN`,
102102
)
103103

104104
return {
105-
marketStatus: MarketStatus.CLOSED,
105+
marketStatus: MarketStatus.UNKNOWN,
106106
providerIndicatedTimeUnixMs: Date.now(),
107107
}
108108
}

packages/composites/market-status/test/integration/adapter.test.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import {
66
import FakeTimers from '@sinonjs/fake-timers'
77

88
import * as fixtures from './fixtures'
9-
import { MockCache } from '@chainlink/external-adapter-framework/util/testing-utils'
10-
import { runAllUntil } from '@chainlink/external-adapter-framework/util/testing-utils'
119

1210
describe('execute', () => {
1311
let clock: FakeTimers.InstalledClock
@@ -107,7 +105,7 @@ describe('execute', () => {
107105
})
108106
})
109107

110-
it.only('returns ncfx if tradinghours is failing', async () => {
108+
it('returns ncfx if tradinghours is failing', async () => {
111109
const market = 'test-4'
112110
fixtures.mockTradinghoursError(market)
113111
fixtures.mockNCFXOpen(market)
@@ -128,17 +126,17 @@ describe('execute', () => {
128126
})
129127
})
130128

131-
it('returns closed if tradinghours is failing and ncfx is failing', async () => {
129+
it('returns unknown if tradinghours is failing and ncfx is failing', async () => {
132130
const market = 'test-5'
133131
fixtures.mockTradinghoursError(market)
134132
fixtures.mockNCFXError(market)
135133

136134
const response = await waitForSuccessfulRequest({ market })
137135
expect(response.json()).toEqual({
138136
data: {
139-
result: 1,
137+
result: 0,
140138
},
141-
result: 1,
139+
result: 0,
142140
statusCode: 200,
143141
timestamps: {
144142
providerDataReceivedUnixMs: expect.any(Number),
@@ -148,17 +146,17 @@ describe('execute', () => {
148146
})
149147
})
150148

151-
it('returns closed if tradinghours is failing and ncfx is unknown', async () => {
149+
it('returns unknown if tradinghours is failing and ncfx is unknown', async () => {
152150
const market = 'test-6'
153151
fixtures.mockTradinghoursError(market)
154152
fixtures.mockNCFXUnknown(market)
155153

156154
const response = await waitForSuccessfulRequest({ market })
157155
expect(response.json()).toEqual({
158156
data: {
159-
result: 1,
157+
result: 0,
160158
},
161-
result: 1,
159+
result: 0,
162160
statusCode: 200,
163161
timestamps: {
164162
providerDataReceivedUnixMs: expect.any(Number),

packages/composites/market-status/test/integration/setup.ts

-56
This file was deleted.

0 commit comments

Comments
 (0)