aboutsummaryrefslogtreecommitdiffstats
path: root/test/integration/lib/currency-localization.js
blob: 3ad1a23e528298f66b6e2dd815192198989d8cb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const reactTriggerChange = require('../../lib/react-trigger-change')
const {
  timeout,
  queryAsync,
  findAsync,
} = require('../../lib/util')

QUnit.module('currency localization')

QUnit.test('renders localized currency', (assert) => {
  const done = assert.async()
  runCurrencyLocalizationTest(assert).then(done).catch((err) => {
    assert.notOk(err, `Error was thrown: ${err.stack}`)
    done()
  })
})

async function runCurrencyLocalizationTest (assert, done) {
  console.log('*** start runCurrencyLocalizationTest')
  const selectState = await queryAsync($, 'select')
  selectState.val('currency localization')
  reactTriggerChange(selectState[0])
  await timeout(1000)
  const txView = await queryAsync($, '.tx-view')
  const heroBalance = await findAsync($(txView), '.hero-balance')
  const fiatAmount = await findAsync($(heroBalance), '.fiat-amount')
  assert.equal(fiatAmount[0].textContent, '₱102,707.97')
}