Skip to content

Commit a0389e6

Browse files
committed
feat: add tests for this instruction and setMaxLatency
1 parent 337bc21 commit a0389e6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/__tests__/Anchor.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,5 +203,27 @@ test('Anchor', (done) => {
203203
expect(decoded?.data.securityAuthority.equals(new PublicKey(8))).toBeTruthy()
204204
})
205205

206+
pythOracle.methods
207+
.setMaxLatency(1, [0,0,0])
208+
.accounts({ fundingAccount: PublicKey.unique(), priceAccount: PublicKey.unique() })
209+
.instruction()
210+
.then((instruction) => {
211+
expect(instruction.data).toStrictEqual(Buffer.from([2, 0, 0, 0, 18, 0, 0, 0, 1, 0, 0, 0]))
212+
const decoded = pythOracleCoder().instruction.decode(instruction.data)
213+
expect(decoded?.name).toBe('setMaxLatency')
214+
expect(decoded?.data.maxLatency === 1).toBeTruthy()
215+
})
216+
217+
pythOracle.methods
218+
.initPriceFeedIndex()
219+
.accounts({ fundingAccount: PublicKey.unique(), priceAccount: PublicKey.unique(), permissionsAccount: PublicKey.unique() })
220+
.instruction()
221+
.then((instruction) => {
222+
expect(instruction.data).toStrictEqual(Buffer.from([2, 0, 0, 0, 19, 0, 0, 0]))
223+
const decoded = pythOracleCoder().instruction.decode(instruction.data)
224+
expect(decoded?.name).toBe('initPriceFeedIndex')
225+
expect(decoded?.data).toStrictEqual({})
226+
})
227+
206228
done()
207229
})

0 commit comments

Comments
 (0)