Skip to content

Instantly share code, notes, and snippets.

@agawish
Last active March 21, 2018 00:26
Show Gist options
  • Save agawish/489819fd6d668f1302512f460737d22a to your computer and use it in GitHub Desktop.
Save agawish/489819fd6d668f1302512f460737d22a to your computer and use it in GitHub Desktop.
Survey DApp Tests - After Creating Helpers
/* Loading all libraries from common */
const {
SurveyFactory, //Survey Factor Contract
Survey, //Survey Contract
BigNumber, //BigNumber from web3 (for ease to use)
CommonVariables, //Multiple common variables
expectRevert, //Check if the Solidity returns "revert" exception (usually result from require failed)
} = require('./helpers/common');
contract('Survey', _accounts => {
const commonVars = new CommonVariables(_accounts);
let accounts = commonVars.accounts;
const _appOwner = commonVars.appOwner;
const _surveyMaker = commonVars.surveyMaker;
const _participants = commonVars.participants;
const _surveyCreationCost = commonVars.surveyCreationCost;
const _surveyReward = commonVars.surveyReward;
const _surveyRewardAndCreationCost = commonVars.surveyRewardAndCreationCost;
let surveyFactory = null;
let survey = null;
beforeEach(async () => {
surveyFactory = await SurveyFactory.new(_surveyCreationCost, { from: _appOwner });
// TODO - create a survey!
});
describe('[TEST_CASES_LOGICAL_GROUP_HERE]', () => {
it(`1. Given that I'm the ____
2. When I ____
3. Then I should ____`, () => {
/* Test Login here */
});
});
});
/* Loading all libraries from common */
const {
SurveyFactory, //Survey Factor Contract
Survey, //Survey Contract
BigNumber, //BigNumber from web3 (for ease to use)
CommonVariables, //Multiple common variables
expectRevert, //Check if the Solidity returns "revert" exception (usually result from require failed)
} = require('./helpers/common');
contract('SurveyFactory', _accounts => {
/* Initialization code here */
const commonVars = new CommonVariables(_accounts);
let accounts = commonVars.accounts;
const _appOwner = commonVars.appOwner;
const _surveyMaker = commonVars.surveyMaker;
const _participants = commonVars.participants;
const _surveyCreationCost = commonVars.surveyCreationCost;
const _surveyReward = commonVars.surveyReward;
const _surveyRewardAndCreationCost = commonVars.surveyRewardAndCreationCost;
let surveyFactory = null;
beforeEach(async () => {
surveyFactory = await SurveyFactory.new(_surveyCreationCost, { from: _appOwner });
});
describe('[TEST_CASES_LOGICAL_GROUP_HERE]', () => {
it(`1. Given that I'm the ____
2. When I ____
3. Then I should ____`, () => {
/* Test Login here */
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment