augur-ui-react-components
Advanced tools
Comparing version 3.0.51 to 3.0.52
{ | ||
"name": "augur-ui-react-components", | ||
"version": "3.0.51", | ||
"version": "3.0.52", | ||
"description": "Augur UI React Components", | ||
@@ -5,0 +5,0 @@ "author": "Augur Developers", |
@@ -31,2 +31,4 @@ import activePage from '../test/assertions/active-page'; | ||
import myMarketsSummary from '../test/assertions/my-markets-summary'; | ||
import myReports from '../test/assertions/my-reports'; | ||
import myReportsSummary from '../test/assertions/my-reports-summary'; | ||
import loginAccountReports from '../test/assertions/login-account-reports'; | ||
@@ -67,3 +69,5 @@ import portfolioTotals from '../test/assertions/portfolio-totals'; | ||
myMarketsSummary, | ||
myReports, | ||
myReportsSummary, | ||
loginAccountReports | ||
}; |
@@ -67,6 +67,5 @@ import React, { PropTypes } from 'react'; | ||
repEarned: PropTypes.object.isRequired, | ||
endDate: PropTypes.object.isRequired, | ||
isChallengeable: PropTypes.bool.isRequired | ||
endDate: PropTypes.object.isRequired | ||
}; | ||
export default Report; |
@@ -22,3 +22,3 @@ import React, { PropTypes } from 'react'; | ||
case MY_REPORTS: | ||
node = <Reports reports={p.reports} />; | ||
node = <Reports {...p.reports} />; | ||
break; | ||
@@ -58,6 +58,6 @@ } | ||
positions: PropTypes.object.isRequired, | ||
markets: PropTypes.array.isRequired, | ||
reports: PropTypes.array.isRequired | ||
markets: PropTypes.object.isRequired, | ||
reports: PropTypes.object.isRequired | ||
}; | ||
export default PortfolioPage; |
@@ -21,2 +21,3 @@ import activePage from './selectors/active-page'; | ||
import loginAccountReports from './selectors/login-account-reports'; | ||
import myReports from './selectors/my-reports'; | ||
@@ -44,3 +45,4 @@ // all selectors should go here | ||
loginAccountMarkets, | ||
loginAccountReports | ||
loginAccountReports, | ||
myReports | ||
}; | ||
@@ -47,0 +49,0 @@ |
@@ -1,47 +0,7 @@ | ||
import { makeDate } from '../utils/make-date'; | ||
import { makeNumber } from '../utils/make-number'; | ||
import reports from '../selectors/my-reports'; | ||
import summary from '../selectors/my-reports-summary'; | ||
const randomBool = () => Math.random() > 0.5; | ||
const randomSign = () => (Math.random() > 0.5 ? 1 : -1); | ||
export default [ | ||
{ | ||
id: '0', | ||
description: 'Will the thorn be added to the english alphabet before 2016?', | ||
outcome: 'No', | ||
outcomePercentage: makeNumber((Math.random() * (100 - 51) + 51), '%'), | ||
reported: 'No', | ||
isReportEqual: randomBool(), | ||
feesEarned: makeNumber(randomSign() * Math.random() * 1.9, ' ETH'), | ||
repEarned: makeNumber(randomSign() * Math.random() * 1.3, ' REP'), | ||
endDate: makeDate(new Date('2015/12/31')), | ||
isChallenged: randomBool(), | ||
isChallengeable: randomBool() | ||
}, | ||
{ | ||
id: '1', | ||
description: 'Will I go back to the future by 2016?', | ||
outcome: null, | ||
outcomePercentage: makeNumber((Math.random() * (100 - 51) + 51), '%'), | ||
reported: 'Yes', | ||
isReportEqual: randomBool(), | ||
feesEarned: makeNumber(randomSign() * Math.random() * 1.2, ' ETH'), | ||
repEarned: makeNumber(randomSign() * Math.random() * 1.3, ' REP'), | ||
endDate: makeDate(new Date('2015/12/31')), | ||
isChallenged: randomBool(), | ||
isChallengeable: randomBool() | ||
}, | ||
{ | ||
id: '2', | ||
description: 'Who will win the US presidential election in 2008?', | ||
outcome: 'Barack Obama', | ||
outcomePercentage: makeNumber((Math.random() * (100 - 51) + 51), '%'), | ||
reported: 'Mitt Romney', | ||
isReportEqual: randomBool(), | ||
feesEarned: makeNumber(randomSign() * Math.random() * 1.8, ' ETH'), | ||
repEarned: makeNumber(randomSign() * Math.random() * 2.1, ' REP'), | ||
endDate: makeDate(new Date('2008/11/4')), | ||
isChallenged: randomBool(), | ||
isChallengeable: randomBool() | ||
} | ||
]; | ||
export default { | ||
reports, | ||
summary | ||
}; |
import { assert } from 'chai'; | ||
import assertFormattedNumber from '../../test/assertions/common/formatted-number'; | ||
import assertFormattedDate from '../../test/assertions/common/formatted-date'; | ||
export default function (loginAccountMarkets){ | ||
describe(`augur-ui-react-components loginAccountMarket's shape`, () => { | ||
assert.isDefined(loginAccountMarkets); | ||
assert.isArray(loginAccountMarkets); | ||
export default function (loginAccountReports){ | ||
describe(`augur-ui-react-components loginAccountReports' shape`, () => { | ||
assert.isDefined(loginAccountReports); | ||
assert.isObject(loginAccountReports); | ||
loginAccountMarkets.forEach(report => { assertLoginAccountMarkets(report) }); | ||
}); | ||
}; | ||
export function assertLoginAccountMarkets(report) { | ||
describe(`report's shape`, () => { | ||
it('id', () => { | ||
assert.isDefined(report.id); | ||
assert.isString(report.id); | ||
it('reports', () => { | ||
assert.isDefined(loginAccountReports.reports); | ||
assert.isArray(loginAccountReports.reports); | ||
}); | ||
it('description', () => { | ||
assert.isDefined(report.description); | ||
assert.isString(report.description); | ||
it('summary', () => { | ||
assert.isDefined(loginAccountReports.summary); | ||
assert.isObject(loginAccountReports.summary); | ||
}); | ||
it('outcome', () => { | ||
assert.isDefined(report.outcome); | ||
report.outcome != null && assert.isString(report.outcome); | ||
}); | ||
it('outcomePercentage', () => { | ||
assert.isDefined(report.outcomePercentage); | ||
assertFormattedNumber(report.outcomePercentage, 'report.fees'); | ||
}); | ||
it('reported', () => { | ||
assert.isDefined(report.reported); | ||
assert.isString(report.reported); | ||
}); | ||
it('isReportEqual', () => { | ||
assert.isDefined(report.isReportEqual); | ||
assert.isBoolean(report.isReportEqual); | ||
}); | ||
it('feesEarned', () => { | ||
assert.isDefined(report.feesEarned); | ||
assertFormattedNumber(report.feesEarned, 'report.feesEarned'); | ||
}); | ||
it('repEarned', () => { | ||
assert.isDefined(report.repEarned); | ||
assertFormattedNumber(report.repEarned, 'report.repEarned'); | ||
}); | ||
it('endDate', () => { | ||
assert.isDefined(report.endDate); | ||
assertFormattedDate(report.endDate, 'report.endDate'); | ||
}); | ||
it('isChallenged', () => { | ||
assert.isDefined(report.isChallenged); | ||
assert.isBoolean(report.isChallenged); | ||
}); | ||
it('isChallangeable', () => { | ||
assert.isDefined(report.isChallengeable); | ||
assert.isBoolean(report.isChallengeable); | ||
}); | ||
}); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1215608
206
10271