Skip to content

Commit

Permalink
fix tests after breaking them in [382892a]
Browse files Browse the repository at this point in the history
  • Loading branch information
quafzi committed Mar 25, 2017
1 parent cf3c769 commit 464e188
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
11 changes: 6 additions & 5 deletions src/app/report/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const m = require('mithril')
const mq = require('mithril-query')
const moment = require('moment')
const nbsp = '\u00a0'

const expect = require('expect.js')
const columnSelectionView = require('./').columnSelectionView
Expand Down Expand Up @@ -162,23 +163,23 @@ describe('turning filters into fetch options', () => {
rows: [
{
description: 'brainstorming',
duration: (7 * 24).toFixed(2) + ' h',
duration: (7 * 24).toFixed(2) + nbsp + 'h',
project: 'save the world',
tags: ''
},
{
description: 'delete everything that is not nemo',
project: 'find nemo',
duration: '2.50 h',
duration: '2.50' + nbsp + 'h',
tags: ''
}
],
sender: 'Winnetouch, Puderrosa Ranch',
subject: 'Invoice',
totals: {
subtotal: { title: 'invoice.totals.subtotal', value: (7 * 24 * 100 + 2.5 * 30).toFixed(2) + ' €' },
tax: { title: 'invoice.totals.tax', value: ((7 * 24 * 100 + 2.5 * 30) * 0.19).toFixed(2) + ' €' },
grand_total: { title: 'invoice.totals.grand_total', value: ((7 * 24 * 100 + 2.5 * 30) * 1.19).toFixed(2) + ' €' }
subtotal: { title: 'invoice.totals.subtotal', value: (7 * 24 * 100 + 2.5 * 30).toFixed(2) + nbsp + '€' },
tax: { title: 'invoice.totals.tax', value: ((7 * 24 * 100 + 2.5 * 30) * 0.19).toFixed(2) + nbsp + '€' },
grand_total: { title: 'invoice.totals.grand_total', value: ((7 * 24 * 100 + 2.5 * 30) * 1.19).toFixed(2) + nbsp + '€' }
}
})
})
Expand Down
7 changes: 4 additions & 3 deletions src/app/report/item.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const mq = require('mithril-query')
const expect = require('expect.js')
const nbsp = '\u00a0'

const itemComponent = require('./item')

Expand Down Expand Up @@ -45,19 +46,19 @@ describe('render report item', () => {
item.duration = 3600
let out = mq(itemComponent.view({ item: item, columns: columns }))
out.should.have(1, 'td.duration')
expect(out.first('td.duration').children).to.eql(['1.00 h'])
expect(out.first('td.duration').children).to.eql(['1.00' + nbsp + 'h'])
})
it('when we need to round up', () => {
item.duration = 1797
let out = mq(itemComponent.view({ item: item, columns: columns }))
out.should.have(1, 'td.duration')
expect(out.first('td.duration').children).to.eql(['0.50 h'])
expect(out.first('td.duration').children).to.eql(['0.50' + nbsp + 'h'])
})
it('when we need to round down', () => {
item.duration = 7203
let out = mq(itemComponent.view({ item: item, columns: columns }))
out.should.have(1, 'td.duration')
expect(out.first('td.duration').children).to.eql(['2.00 h'])
expect(out.first('td.duration').children).to.eql(['2.00' + nbsp + 'h'])
})
})
})
2 changes: 1 addition & 1 deletion src/app/report/totals.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ describe('render totals', () => {
out.should.have(1, 'tr')
out.should.have(1, 'th[colspan=3]')
out.should.have(1, 'td.duration.total')
expect(out.first('td').children[0]).to.match(/123[,.]50 h/)
expect(out.first('td').children[0]).to.match(/123[,.]50.h/)
})
})
3 changes: 2 additions & 1 deletion src/app/shell/merger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ describe('merger', function () {
const out = mq(merger.examplesView(scope))
out.should.have(1, '.examples')
out.should.have(1, '.examples select')
out.should.have(3, '.examples select option')
out.should.have(4, '.examples select option')
out.should.have(1, '.examples select option[value="–"]')
out.should.have(1, '.examples select option[value="custom code"]')
out.should.have(1, '.examples select option[value="testingFoo"]')
out.should.have('1, .examples select option[value="testingAdditionalStaticRow"]')
Expand Down
2 changes: 1 addition & 1 deletion src/translations/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ module.exports = {
'shell.merger.description': 'You may modify these items as you want. Use your own code or choose from the existing ones:',
'shell.merger.example.groupByActivity': 'group by activity',
'shell.merger.example.none': '–',
'shell.merger.example.own': 'own code',
'shell.merger.example.own': 'custom code',
'shell.merger.title': 'configure list',
'tag.add': 'Add tag',
'tag.property.name': 'Tag name',
Expand Down

0 comments on commit 464e188

Please sign in to comment.