it(`should handle a binary market step 4`, () => {
		state.createMarketInProgress.step = 4;
		actual = selector.default();
		// console.log(actual);
		assertions.createMarketForm(actual);
		state.createMarketInProgress = actual;
	});
		it('should deliver the correct values to components', () => {
			let fullTestState = {
				...state.createMarketInProgress,
				...actualStep4.select(state.createMarketInProgress)
			};

			assertions.createMarketForm(fullTestState);
		});
Example #3
0
	it(`should handle a login form`, () => {
		state.auth = {
			err: null,
			selectedAuthType: 'login'
		};
		// console.log(authForm.default());
		assertions.authForm(authForm.default());
	});
Example #4
0
	it(`should handle a unrecognized authType`, () => {
		state.auth = {
			err: null,
			selectedAuthType: 'some incorrect value'
		};
		// console.log(authForm.default());
		assertions.authForm(authForm.default());
	});
Example #5
0
	it(`should handle passwords not matching`, () => {
		state.auth = {
			err: {
				code: PASSWORDS_DO_NOT_MATCH
			},
			selectedAuthType: 'login'
		};
		// console.log(authForm.default());
		assertions.authForm(authForm.default());
	});
Example #6
0
	it(`should handle taken usernames`, () => {
		state.auth = {
			err: {
				code: USERNAME_TAKEN
			},
			selectedAuthType: 'login'
		};
		// console.log(authForm.default());
		assertions.authForm(authForm.default());
	});
Example #7
0
	it(`should handle username missing`, () => {
		state.auth = {
			err: {
				code: USERNAME_REQUIRED
			},
			selectedAuthType: 'login'
		};
		// console.log(authForm.default());
		assertions.authForm(authForm.default());
	});
Example #8
0
	it(`should change the selected page number`, () => {
		actual = selector.default();
		expected = [{
			type: 'UPDATE_SELECTED_PAGE_NUM',
			pageNum: 4
		}];
		assertions.pagination(actual);
		actual.onUpdateSelectedPageNum(4);
		assert.deepEqual(store.getActions(), expected, `Didn't dispatch the expected action objects when onUpdateSelectedPageNum was called.`);
	});
Example #9
0
	it(`should handle invalid user name or password`, () => {
		state.auth = {
			err: {
				code: INVALID_USERNAME_OR_PASSWORD
			},
			selectedAuthType: 'login'
		};
		// console.log(authForm.default());
		assertions.authForm(authForm.default());
	});
Example #10
0
	it(`should return data on all transactions`, () => {
		actual = selector.default();

		expected = [{
			id: 'testtransaction12345',
			message: 'test message',
			status: 'failed',
			type: 'register',
			gas: {
				value: 40,
				formattedValue: 40,
				formatted: '+40.00',
				roundedValue: 40,
				rounded: '+40.0',
				minimized: '+40',
				denomination: 'Eth',
				full: '+40.00Eth'
			},
			repChange: 100,
			sharesChange: 10,
			etherWithoutGas: 150,
			ether: {
				value: 150,
				formattedValue: 150,
				formatted: '+150.00',
				roundedValue: 150,
				rounded: '+150.0',
				minimized: '+150',
				denomination: 'Eth',
				full: '+150.00Eth'
			},
			shares: {
				value: 10,
				formattedValue: 10,
				formatted: '10',
				roundedValue: 10,
				rounded: '10',
				minimized: '10',
				denomination: 'Shares',
				full: '10Shares'
			},
			rep: {
				value: 100,
				formattedValue: 100,
				formatted: '+100',
				roundedValue: 100,
				rounded: '+100',
				minimized: '+100',
				denomination: 'Rep',
				full: '+100Rep'
			}
		}];
		assertions.transactions(actual);
		assert.deepEqual(actual, expected, `Didn't return the correct information`);
	});
Example #11
0
	it(`should handle unrecognized errors gracefully`, () => {
		state.auth = {
			err: {
				code: 'unrecognized error',
				message: 'some error message'
			},
			selectedAuthType: 'login'
		};
		// console.log(authForm.default());
		assertions.authForm(authForm.default());
	});
Example #12
0
	it(`should handle passwords that are too short`, () => {
		state.auth = {
			err: {
				code: PASSWORD_TOO_SHORT,
				message: 'password is too short!'
			},
			selectedAuthType: 'login'
		};
		// console.log(authForm.default());
		assertions.authForm(authForm.default());
	});
		it('should deliver the correct values to components', () => {
			let fullTestState = {
				...state.createMarketInProgress,
				...actualStep5.select(
					state.createMarketInProgress,
					state.blockchain.currentBlockNumber,
					state.blockchain.currentBlockMillisSinceEpoch,
					store.dispatch
				)
			};

			assertions.createMarketForm(fullTestState);
		});
	it(`should properly return total info on transactions`, () => {
		actual = mockSelector.default();
		expected = {
			numWorking: 0,
			numPending: 1,
			numComplete: 3,
			numWorkingAndPending: 1,
			numTotal: 4,
			title: '1 Transaction Working',
			transactions: undefined,
			shortTitle: '1 Working'
		};
		assertions.transactionsTotals(actual);
		assert.deepEqual(actual, expected, `Didn't return total info on transactions`);
	})
			types.map((cV) => {
				state.createMarketInProgress.type = cV;

				if(cV === SCALAR){
					state.createMarketInProgress = {
						...state.createMarketInProgress,
						scalarSmallNum: 10,
						scalarBigNum: 100
					};
				}

				let fullTestState = {
					...test,
					...state.createMarketInProgress,
					...actualStep2.initialFairPrices(state.createMarketInProgress),
					...actualStep2.select(state.createMarketInProgress)
				};

				assertions.createMarketForm(fullTestState);
			});
Example #16
0
	it(`should select the correct Markets Header`, () => {
		actual = selector.default();
		expected = [{
			type: 'UPDATE_SELECTED_MARKETS_HEADER',
			header: null
		}, {
			type: 'UPDATE_SELECTED_MARKETS_HEADER',
			header: 'favorites'
		}, {
			type: 'UPDATE_SELECTED_MARKETS_HEADER',
			header: 'pending reports'
		}];

		assertions.marketsHeader(actual)

		actual.onClickAllMarkets();
		actual.onClickFavorites();
		actual.onClickPendingReports();

		assert.deepEqual(store.getActions(), expected, `Didn't dispatch the expected action objects from onclick events`);
	});
Example #17
0
	it(`should get active page from store`, () => {
		let actual = selector();
		assertions.activePage(actual);
	});
Example #18
0
	it(`should login an account`, () => {
		actual = selector.default();
		assertions.loginAccount(actual);
	});
	it(`should handle form initialization`, () => {
		actual = selector.default();
		// console.log(actual);
		state.createMarketInProgress = actual;
		assertions.createMarketForm(actual);
	});
		it('should deliver the correct values to components', () => {
			assertions.createMarketForm(state.createMarketInProgress);
		});
Example #21
0
	it(`should return the correct selectedMarket function`, () => {
		actual = selector.default();

		assertions.markets(actual);
		assert(mockMarket.assembleMarket.calledThrice, `assembleMarket wasn't called 3 times as expected`);
	});