Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iamyulong authored and xstelea committed Mar 31, 2023
1 parent 3fb536b commit 4418cce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions lib/__tests__/manifest-values.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ describe('scrypto value', () => {
[Enum('Foo'), 'Enum("Foo")'],
[
Enum('Foo', String('some string'), Bool(false)),
'Enum("Foo","some string",false)',
'Enum("Foo", "some string", false)',
],
[Enum('Some', String('foobar')), 'Enum("Some","foobar")'],
[Enum('Some', U128('128')), 'Enum("Some",128u128)'],
[Enum('Some', Decimal(219.01234)), 'Enum("Some",Decimal("219.01234"))'],
[Enum('Some', String('foobar')), 'Enum("Some", "foobar")'],
[Enum('Some', U128('128')), 'Enum("Some", 128u128)'],
[Enum('Some', Decimal(219.01234)), 'Enum("Some", Decimal("219.01234"))'],
[Enum('None'), 'Enum("None")'],
[Tuple(Decimal(42.42), String('foo')), 'Tuple(Decimal("42.42"),"foo")'],
[Tuple(Decimal(42.42), String('foo')), 'Tuple(Decimal("42.42"),"foo")'],
Expand Down Expand Up @@ -214,8 +214,8 @@ describe('manifest builder', () => {
Address(
'component_sim1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0tshjs68x'
),
'key',
Enum(0, Enum(0, 'value')),
String('key'),
Enum(0, Enum(0, String('value'))),
])
.build()
.toString()
Expand Down
24 changes: 12 additions & 12 deletions lib/manifest-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ export class ManifestBuilder {
resourceAddress: AddressString,
bucketName: string
): ManifestBuilder {
var temp = nonFungibleLocalIds
let temp = nonFungibleLocalIds
.map(function (id) {
'NonFungibleLocalId("' + id + '")'
return 'NonFungibleLocalId("' + id + '")'
})
.join(', ')
this.instructions.push(
Expand Down Expand Up @@ -153,9 +153,9 @@ export class ManifestBuilder {
nonFungibleLocalIds: NonFungibleLocalIdString[],
resourceAddress: AddressString
): ManifestBuilder {
var temp = nonFungibleLocalIds
let temp = nonFungibleLocalIds
.map(function (id) {
'NonFungibleLocalId("' + id + '")'
return 'NonFungibleLocalId("' + id + '")'
})
.join(', ')
this.instructions.push(
Expand Down Expand Up @@ -254,9 +254,9 @@ export class ManifestBuilder {
resourceAddress: AddressString,
proofName: string
): ManifestBuilder {
var temp = nonFungibleLocalIds
let temp = nonFungibleLocalIds
.map(function (id) {
'NonFungibleLocalId("' + id + '")'
return 'NonFungibleLocalId("' + id + '")'
})
.join(', ')
this.instructions.push(
Expand Down Expand Up @@ -388,7 +388,7 @@ export class ManifestBuilder {
this.instructions.push(
`CALL_METHOD ${Address(accountAddress)} "withdraw" ${Address(
resourceAddress
)} ${Decimal(amount)} ;`
)} ${Decimal(amount)};`
)
return this
}
Expand All @@ -406,17 +406,17 @@ export class ManifestBuilder {
resourceAddress: AddressString,
nonFungibleLocalIds: NonFungibleLocalIdString[]
): ManifestBuilder {
var temp = nonFungibleLocalIds
let temp = nonFungibleLocalIds
.map(function (id) {
'NonFungibleLocalId("' + id + '")'
return 'NonFungibleLocalId("' + id + '")'
})
.join(', ')
this.instructions.push(
`CALL_METHOD ${Address(
accountAddress
)} "withdraw_non_fungibles" ${Address(
resourceAddress
)} Array<NonFungibleLocalId>(${temp})};`
)} Array<NonFungibleLocalId>(${temp});`
)
return this
}
Expand Down Expand Up @@ -476,9 +476,9 @@ export class ManifestBuilder {
resourceAddress: AddressString,
nonFungibleLocalIds: NonFungibleLocalIdString[]
): ManifestBuilder {
var temp = nonFungibleLocalIds
let temp = nonFungibleLocalIds
.map(function (id) {
'NonFungibleLocalId("' + id + '")'
return 'NonFungibleLocalId("' + id + '")'
})
.join(', ')
this.instructions.push(
Expand Down
4 changes: 2 additions & 2 deletions lib/manifest-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ export const String = <T extends string>(str: T): `"${T}"` => {
export const Enum = (field: string | number, ...args: string[]): string => {
if (typeof field === 'number') {
return args.length > 0
? `Enum(${field}u8,${args.join(',')})`
? `Enum(${field}u8, ${args.join(', ')})`
: `Enum(${field}u8)`
} else {
return args.length > 0
? `Enum("${field}",${args.join(',')})`
? `Enum("${field}", ${args.join(', ')})`
: `Enum("${field}")`
}
}
Expand Down

0 comments on commit 4418cce

Please sign in to comment.