Skip to content

Commit

Permalink
test(adapter): update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
envin3 committed Nov 7, 2024
1 parent 9bb3704 commit eb0b68e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
4 changes: 1 addition & 3 deletions cpp/test/adapter-local.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ describe('Adapter EOS -> ETH testing', () => {
.setfeemanagr([feemanager])
.send(active(adapter.account))

const row = adapter.contract.tables
.regadapter(getAccountCodeRaw(adapter.account))
.getTableRow(getSymbolCodeRaw(token.maxSupply))
const row = getSingletonInstance(adapter.contract, 'regadapter')

const storage = getSingletonInstance(adapter.contract, TABLE_STORAGE)

Expand Down
23 changes: 7 additions & 16 deletions cpp/test/adapter-non-local.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ const errors = require('./utils/errors')
const ethers = require('ethers')
const {
evmOperationSamples,
amounts,
evmTopicZero,
evmAdapter,
} = require('./samples/evm-operations')
const { evmMetadataSamples, teePubKey } = require('./samples/evm-metadata')
const { adjustPrecision } = require('./utils/precision-utils')

const attestation = 'deadbeef'
const NULL_KEY = 'PUB_K1_11111111111111111111111111111111149Mr2R' // null initialization of public_key() CDT function

describe('Adapter EVM -> EOS testing', () => {
const evmTokenSymbol = 'TST'
Expand All @@ -35,8 +33,6 @@ describe('Adapter EVM -> EOS testing', () => {
const evmXERC20Precision = 8

const TABLE_STORAGE = 'storage'
const FEE_BASIS_POINTS = 1750
const FEE_BASIS_POINTS_DIVISOR = 1000000

// infos of the underlying token
const evmUnderlyingToken = {
Expand Down Expand Up @@ -313,9 +309,7 @@ describe('Adapter EVM -> EOS testing', () => {
])
.send(active(adapter.account))

const row = adapter.contract.tables
.regadapter(getAccountCodeRaw(adapter.account))
.getTableRow(getSymbolCodeRaw(evmUnderlyingToken.maxSupply))
const row = getSingletonInstance(adapter.contract, 'regadapter')
const storage = getSingletonInstance(adapter.contract, TABLE_STORAGE)
const tee = getSingletonInstance(adapter.contract, 'tee')
const mappingsRow = adapter.contract.tables
Expand All @@ -324,10 +318,7 @@ describe('Adapter EVM -> EOS testing', () => {

expect(row).to.be.deep.equal({
token: '',
token_symbol: precision(
evmUnderlyingToken.precision,
evmUnderlyingToken.symbol,
),
token_symbol: precision(0, 'XXX'),
token_bytes: evmUnderlyingToken.bytes,
xerc20: evmXERC20.account,
xerc20_symbol: precision(evmXERC20.precision, evmXERC20.symbol),
Expand All @@ -344,16 +335,16 @@ describe('Adapter EVM -> EOS testing', () => {
it('Should throw if already created', async () => {
const action = adapter.contract.actions
.create([
evmXERC20.account,
precision(evmXERC20.precision, evmXERC20.symbol),
evmUnderlyingToken.account,
precision(evmUnderlyingToken.precision, evmUnderlyingToken.symbol),
'xerc20.2',
precision(6, 'XERC'),
'local',
precision(6, 'XXX'),
evmUnderlyingToken.bytes,
evmXERC20.minFee,
])
.send(active(adapter.account))

await expectToThrow(action, 'eosio_assert: token already registered')
await expectToThrow(action, 'eosio_assert: adapter already registered')
})
})

Expand Down

0 comments on commit eb0b68e

Please sign in to comment.