Skip to content

Commit

Permalink
Merge pull request #156 from fioprotocol/release/2.4.x_3.0.x
Browse files Browse the repository at this point in the history
Release/2.4.x_3.0.x > master contract Release 2.4.1
  • Loading branch information
ericbutz authored Aug 26, 2021
2 parents 73412cc + 9de8626 commit 40c3cbc
Show file tree
Hide file tree
Showing 49 changed files with 13,623 additions and 4,317 deletions.
19 changes: 8 additions & 11 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
const TESTURL = 'http://localhost:8889'
//const TESTURL = 'http://testnet.fioprotocol.io'
//const TESTURL = 'http://52.183.126.67:8889' //dev1
//const TESTURL = 'http://dev2.fio.dev:8889'
//const TESTURL = 'http://dev3.fio.dev:8889'
//const TESTURL = 'http://dev3.fio.dev:8080' // 8080 is the history node
//const TESTURL = 'http://dev4.fio.dev:8889'
//const TESTURL = 'https://fio.greymass.com' //Mainnet
//const TESTURL = 'http://44.238.153.162:8889' //Devnet
const TESTURL = 'http://localhost:8889' // Localhost
//const TESTURL = 'http://dev1.fio.dev:8888' // DEV1
//const TESTURL = 'http://44.238.153.162:8889' // Devnet
//const TESTURL = 'http://testnet.fioprotocol.io' // Testnet
//const TESTURL = 'https://fio.greymass.com' // Mainnet
//const TESTURL = 'http://34.222.201.72:8080' // History

const DEVTOOLSDIR = '../fio.devtools'

Expand All @@ -15,7 +12,7 @@ const config = {
URL: TESTURL,
BASE_URL: TESTURL + '/v1/',
CLIO: DEVTOOLSDIR + '/bin/clio -u ' + TESTURL,
WALLETKEY: 'PW5JqTyLtZXzmDhVjP6jKK2yJ4tbXA4Gi9zaTepYF9b73U1DZhzmv', // Unlocks local FIO wallet
WALLETKEYFILE: DEVTOOLSDIR + '/walletkey.ini',

//use this prod key file after you get a copy of the file from Ed, then you can run the
//fee-voting-fee-setting.js.
Expand Down Expand Up @@ -121,7 +118,7 @@ const config = {
statusCode: 500
},
invalidContract: {
message: 'Invalid Contract',
message: 'Contract name invalid or not found',
statusCode: 500
},
invalidActorAuth: {
Expand Down
34 changes: 16 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,38 @@ const {expect} = require('chai')

describe('TEST SUITE', () => {

//require('./tests/history.js'); // Only run against history node.
//require('./tests/bravo-migr-test.js'); //This is required when testing 2.3.0 (bravo) with fio bahamas (need to do the full table migration).


require('./tests/addaddress.js'); // v1.0.x Also includes FIP-13 tests.
require('./tests/fees.js'); // v1.0.x
require('./tests/fio-request.js'); // v1.0.x
require('./tests/producer.js'); // v1.0.x
require('./tests/pushtransaction.js'); // v1.0.x
require('./tests/ram2.js'); // v1.0.x //Eric to update to remove clio
require('./tests/register_fio_domain.js'); // v1.0.x
require('./tests/register-fio-address.js');
require('./tests/register-fio-domain.js'); // v1.0.x
require('./tests/transfer-tokens.js'); // v1.0.x
require('./tests/vote.js'); // v1.0.x
//require('./tests/action-whitelisting.js'); // FIP-12, fio v2.0.0, fio.contracts v2.0.0 // Causes future tests to fail. Only run alone.
require('./tests/action-whitelisting.js'); // FIP-12, fio v2.0.0, fio.contracts v2.0.0 // Causes future tests to fail. Only run alone.
require('./tests/transfer-domain.js'); // FIP-1.a, fio v2.0.0, fio.contracts v2.1.0
require('./tests/paging.js'); // FIP-2, fio v2.0.0, fio.contracts v2.1.0
require('./tests/removeaddress.js'); // FIP-4, fio v2.0.0, fio.contracts v2.1.0
require('./tests/remove-address.js'); // FIP-4, fio v2.0.0, fio.contracts v2.1.0
require('./tests/txn-resubmit.js'); //Available with fiosdk_typescript v1.2.0
require('./tests/burn-address.js'); // FIP-7
//require('./tests/fee-voting-fee-setting.js'); // FIP-10
//require('./tests/producer-fee-setting.js'); // FIP-10
require('./tests/record-obt-data.js'); //FIP-1b testing
//require('./tests/bravo-migr-test.js'); // FIP-1.b Only used to test table migration for Request/OBT optimization update
require('./tests/record-obt-data.js'); //FIP-1.b testing
require('./tests/transfer-address.js'); // FIP-1.b
require('./tests/transfer-locked-tokens.js'); // FIP-6 locking tests
require('./tests/transfer-locked-tokens-account-tests.js'); // FIP-6 tests of generic account functionality

require('./tests/addbundles.js'); // FIP-11.a
require('./tests/tpid.js');
require('./tests/transfer-address.js'); // FIP-1.b
require('./tests/addbundles.js');
//require('./tests/clio.js'); // FIP-6 (Bahamas release)
//require('./tests/clio.js'); // FIP-16 //Only works with local testing
//require('./tests/performance-request-obt.js');

require('./tests/testnet-smoketest.js'); // Testnet smoketest. By default runs against local build.

//require('./tests/locks.js'); // Depends on local wallet. Need to fix
//require('./tests/testnet-smoketest.js'); // In development
//require('./tests/pub_k1.js'); // Moved to later release
//require('./tests/expired-domains.js'); // In development

//TODO - Need to update: require('./tests/permissions.js');
//TODO - Need to update: require('./tests/max-txn-size.js');
//require('./tests/expired-address-domain.js'); // Requires manual updates to contracts to shorten expiration timing
//require('./tests/history.js'); // Only run against history node.
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"typescript": "^3.8.2"
},
"scripts": {
"test": "mocha -t 5000000 index.js"
"test": "node node_modules/mocha/bin/_mocha -t 5000000 index.js",
"testnet": "mocha -t 5000000 tests/testnet-smoketest.js"
}
}
30 changes: 15 additions & 15 deletions tests/Archive/fio-smoketest.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//require('mocha')
//const { expect } = require('chai')
//const {FIOSDK } = require('@fioprotocol/FIOSDK')
//const {FIOSDK } = require('@fioprotocol/fiosdk')
//const fioData = require('./serverResponses');
//const fiojs = require("@fioprotocol/fiojs");
//const Transactions_2 = require("@fioprotocol/FIOSDK/lib/transactions/Transactions")
//const Transactions_2 = require("@fioprotocol/fiosdk/lib/transactions/Transactions")
//let transaction = new Transactions_2.Transactions

require('mocha')
const {expect} = require('chai')
const {newUser, getProdVoteTotal, importPrivKey, unlockWallet, addLock, getAccountVoteWeight, getTotalVotedFio, fetchJson} = require('../utils.js');
const {FIOSDK } = require('@fioprotocol/FIOSDK')
const {FIOSDK } = require('@fioprotocol/fiosdk')
config = require('../config.js');

before(async () => {
Expand All @@ -26,12 +26,12 @@ describe('A. Transferring tokens to Happy', () => {

it(`getFioBalance for happy returns: ${config.error.keyNotFound}`, async () => {
try {
const result = await happyB1.sdk.genericAction('getFioBalance', { })
const result = await happyB1.sdk.genericAction('getFioBalance', { })
} catch (err) {
expect(err.json.message).to.equal(config.error.keyNotFound)
}
}
})

it(`Transfer ${fundsAmount} FIO to Happy's FIO public key`, async () => {
const result = await faucet.genericAction('transferTokens', {
payeeFioPublicKey: happyB1.publicKey,
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('A. Transferring tokens to Happy', () => {
it(`Happy's FIO public key has ${1.5*fundsAmount} FIO`, async () => {
const result = await happyB1.sdk.genericAction('getFioBalance', {})
//console.log('Result: ', result)
expect(result.balance).to.equal(1.5*fundsAmount)
expect(result.balance).to.equal(1.5*fundsAmount)
})

})
Expand All @@ -80,10 +80,10 @@ describe('C. Transfer Tokens Sad', () => {
try {
const result = await sadC1.sdk.genericAction('getFioBalance', {
fioPublicKey: sadC1.publicKey
})
})
} catch (err) {
expect(err.json.message).to.equal(config.keyNotFound)
}
}
})

it(`Transfer to empty public key returns: ${config.error.invalidKey}`, async () => {
Expand All @@ -97,7 +97,7 @@ describe('C. Transfer Tokens Sad', () => {
} catch (err) {
//console.log('Error: ', err.json)
expect(err.json.fields[0].error).to.equal(config.error.invalidKey)
}
}
})

it(`Transfer ${100000000000000000/1000000000} returns: ${config.error.insufficientBalance}`, async () => {
Expand All @@ -111,7 +111,7 @@ describe('C. Transfer Tokens Sad', () => {
} catch (err) {
//console.log('Error: ', err.json)
expect(err.json.fields[0].error).to.equal(config.error.insufficientBalance)
}
}
})

it(`Transfer without enough FEE returns ${config.error.feeExceedsMax}`, async () => {
Expand All @@ -125,9 +125,9 @@ describe('C. Transfer Tokens Sad', () => {
} catch (err) {
//console.log('Error: ', err.json)
expect(err.json.fields[0].error).to.equal(config.error.feeExceedsMax)
}
}
})

it(`Transfer to invalid public key returns ${config.error.invalidKey}`, async () => {
try {
const result = await faucet.genericAction('transferTokens', {
Expand All @@ -139,7 +139,7 @@ describe('C. Transfer Tokens Sad', () => {
} catch (err) {
//console.log('Error: ', err.json)
expect(err.json.fields[0].error).to.equal(config.error.invalidKey)
}
}
})

it(`Transfer -100 returns ${config.error.invalidAmount}`, async () => {
Expand All @@ -153,7 +153,7 @@ describe('C. Transfer Tokens Sad', () => {
} catch (err) {
//console.log('Error: ', err.json)
expect(err.json.fields[0].error).to.equal(config.error.invalidAmount)
}
}
})
})

Loading

0 comments on commit 40c3cbc

Please sign in to comment.