Skip to content

Commit ec581cb

Browse files
committed
fix: remove set item tests as arc4 struct is now immutable
1 parent 1486abb commit ec581cb

File tree

1 file changed

+1
-44
lines changed

1 file changed

+1
-44
lines changed

tests/arc4/struct.spec.ts

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getABIEncodedValue } from '@algorandfoundation/algokit-utils/types/app-
22
import { Bytes, internal } from '@algorandfoundation/algorand-typescript'
33
import { Bool, DynamicArray, interpretAsArc4, StaticArray, Str, Struct, Tuple, UintN } from '@algorandfoundation/algorand-typescript/arc4'
44
import { encodingUtil } from '@algorandfoundation/puya-ts'
5-
import { describe, expect, it, test } from 'vitest'
5+
import { describe, expect, test } from 'vitest'
66
import { AccountCls } from '../../src/impl/account'
77
import { DeliberateAny } from '../../src/typescript-helpers'
88
import { asBytes } from '../../src/util'
@@ -251,49 +251,6 @@ describe('arc4.Struct', async () => {
251251
compareARC4AndABIValue(result.d, nativeValues[i++])
252252
compareARC4AndABIValue(result.a, nativeValues[i++])
253253
})
254-
255-
it('set item in struct', async () => {
256-
const data = testData[5]
257-
const nativeValues = data.nativeValues() as DeliberateAny
258-
nativeValues[0] = 43
259-
nativeValues[2] = 'world'
260-
nativeValues[3][0][1][0][1] = 'hello, world'
261-
nativeValues[3][0][1][0].push('test')
262-
nativeValues[3][1][1][0] = 24
263-
const sdkResult = getABIEncodedValue(nativeValues, data.abiTypeString, {})
264-
265-
const abiValues = data.struct() as Swapped6
266-
abiValues.b = new UintN<64>(43)
267-
abiValues.d = new Str('world')
268-
abiValues.a.at(0).at(1).at(0)[1] = new Str('hello, world')
269-
abiValues.a.at(0).at(1).at(0).push(new Str('test'))
270-
abiValues.a.at(1).at(1)[0] = new UintN<64>(24)
271-
const result = abiValues.bytes
272-
273-
expect(result).toEqual(Bytes(sdkResult))
274-
})
275-
276-
it('set item in struct created from bytes', async () => {
277-
const data = testData[5]
278-
const nativeValues = data.nativeValues() as DeliberateAny
279-
nativeValues[0] = 43
280-
nativeValues[2] = 'world'
281-
nativeValues[3][0][1][0][1] = 'hello, world'
282-
nativeValues[3][0][1][0].push('test')
283-
nativeValues[3][1][1][0] = 24
284-
const sdkResult = getABIEncodedValue(nativeValues, data.abiTypeString, {})
285-
286-
const bytes = Bytes(getABIEncodedValue(data.nativeValues(), data.abiTypeString, {}))
287-
const abiValues = data.create(bytes) as Swapped6
288-
abiValues.b = new UintN<64>(43)
289-
abiValues.d = new Str('world')
290-
abiValues.a.at(0).at(1).at(0)[1] = new Str('hello, world')
291-
abiValues.a.at(0).at(1).at(0).push(new Str('test'))
292-
abiValues.a.at(1).at(1)[0] = new UintN<64>(24)
293-
const result = abiValues.bytes
294-
295-
expect(result).toEqual(Bytes(sdkResult))
296-
})
297254
})
298255

299256
const compareARC4AndABIValue = (arc4Value: DeliberateAny, nativeValue: DeliberateAny) => {

0 commit comments

Comments
 (0)