Skip to content

Commit

Permalink
Tests that fail due to a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncox committed Dec 8, 2023
1 parent 0d956bf commit 537ffa2
Showing 1 changed file with 62 additions and 1 deletion.
63 changes: 62 additions & 1 deletion test/tests/contract-codegen.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {assert} from 'chai'

import {ABI, APIClient, Name} from '@wharfkit/antelope'
import {ABI, APIClient, Name, Serializer} from '@wharfkit/antelope'
import {makeClient} from '@wharfkit/mock-data'

import fs from 'fs'
Expand Down Expand Up @@ -81,6 +81,67 @@ suite('codegen', async function () {
}
})

test('bug', async function () {
const data: any = {
requirements: {
team_id: [],
min_power: 0,
min_balance: 0,
min_stake: 0,
min_cumulative_team_contribution: 0,
},
actions: {
delegated_stake: 0,
stake_locked_additional_rounds: 0,
nft_actions: [
{
collection_name: 'dddd',
schema_name: 'dddddd',
template_id: '3',
match_immutable_attributes: [
{
key: 'keyname',
value: 'keytest',
},
],
match_mutable_attributes: [],
burn: false,
lock_rounds: 0,
},
],
balance_payment: 0,
},
rewards: {
nft_mints: [],
balance_deposit: 0,
delegated_stake: 0,
stake_locked_additional_rounds: 0,
activate_powermod_ids: [],
},
limits: {
offer_quantity_remaining: 0,
available_until_round: 0,
},
}

const test = Boid.Types.offeradd.from(data)
/**
* The input for `team_id` was an array and comes back as an empty string
*/
assert.equal(test.requirements.team_id, data.requirements.team_id)
/**
* The value of the `actions.nft_actions[0].match_immutable_attributes[0].value` was a string and comes back as an empty object
*/
assert.equal(
String(test.actions.nft_actions[0].match_immutable_attributes[0].value),
'keytest'
)
/**
* The input for `rewards.activated_powermod_ids` was an array and comes back as an empty string
*/
assert.equal(test.rewards.activate_powermod_ids, data.rewards.activate_powermod_ids)
})

suite('Generated vs Static', function () {
test('Contracts are identical', function () {
for (const source of sources) {
Expand Down

0 comments on commit 537ffa2

Please sign in to comment.