Skip to content

Commit

Permalink
test: Set exact dates and english by default
Browse files Browse the repository at this point in the history
  • Loading branch information
tricoder42 committed Mar 6, 2017
1 parent 6539ee1 commit 309b291
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/example-usecase/src/Usecases/Formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Trans, NumberFormat, DateFormat } from 'lingui-react'
class Formats extends React.Component {
render () {
const answer = 0.42
const now = new Date('4/5/2017')
const now = new Date('2017-04-05T11:14:00.000Z')

return (
<div>
Expand Down
8 changes: 4 additions & 4 deletions packages/example-usecase/src/Usecases/Formats.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ describe('Formats', function () {

const getText = (element, props = {}) => {
return mount(
<Component {...props} language="cs"/>).find(element).text()
<Component {...props} language="en"/>).find(element).text()
}

it('should render', function () {
expect(mount(
<Component language="cs"/>)).toMatchSnapshot()
<Component language="en"/>)).toMatchSnapshot()
})

it('should render percent', function () {
expect(getText('.percent')).toEqual('The answer is 42 %')
expect(getText('.percent')).toEqual('The answer is 42%')
})

it('should render date', function () {
expect(getText('.date')).toEqual('Today is 5. 4. 2017')
expect(getText('.date')).toEqual('Today is 4/5/2017')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

exports[`Formats should render 1`] = `
<Component
language="cs"
language="en"
>
<I18nProvider
language="cs"
language="en"
messages={Object {}}
>
<Formats>
Expand All @@ -25,7 +25,7 @@ exports[`Formats should render 1`] = `
className="percent"
i18n={
I18n {
"_language": "cs",
"_language": "en",
"_messages": Object {},
"plural": [Function],
"select": [Function],
Expand All @@ -43,7 +43,7 @@ exports[`Formats should render 1`] = `
<span
className="percent"
>
The answer is 42 %
The answer is 42%
</span>
</Trans>
</WithI18n>
Expand All @@ -54,15 +54,15 @@ exports[`Formats should render 1`] = `
id="Today is {now,date}"
params={
Object {
"now": 2017-04-04T22:00:00.000Z,
"now": 2017-04-05T11:14:00.000Z,
}
}
>
<Trans
className="date"
i18n={
I18n {
"_language": "cs",
"_language": "en",
"_messages": Object {},
"plural": [Function],
"select": [Function],
Expand All @@ -73,14 +73,14 @@ exports[`Formats should render 1`] = `
id="Today is {now,date}"
params={
Object {
"now": 2017-04-04T22:00:00.000Z,
"now": 2017-04-05T11:14:00.000Z,
}
}
>
<span
className="date"
>
Today is 5. 4. 2017
Today is 4/5/2017
</span>
</Trans>
</WithI18n>
Expand Down

0 comments on commit 309b291

Please sign in to comment.