Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
fix(Header): remove (date: Date.now) from formattedMessage
Browse files Browse the repository at this point in the history
fix(Header): remove (date: Date.now) from formattedMessage
  • Loading branch information
Metnew committed Sep 10, 2017
1 parent e113388 commit 39a3358
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/common/api/PostsSvc/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// @flow
import {get} from 'api/utils'
import qs from 'query-string'

export async function getPostsAPI () {
return get('https://jsonplaceholder.typicode.com/posts?userId=1')
export async function getPostsAPI (userId: number = 1) {
const str: string = qs.stringify(userId)
return get(
`https://jsonplaceholder.typicode.com/posts${str ? `?${str}` : ''}`
)
}
33 changes: 33 additions & 0 deletions src/common/components/addons/RouteAuth/index.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react'
import RouteAuth from 'components/addons/RouteAuth'
import {shallow} from 'enzyme'
import toJson from 'enzyme-to-json'

const props = {
path: '/',
canAccess: () => ({})
}

const notInboxPath = '/auth'
const inboxPath = '/inbox'
const accessToInboxOnly = path => {
return path === '/inbox'
}
const accessExceptInbox = path => {
return path !== '/inbox'
}

describe('RouteAuth component', () => {
it('creates <Redirect /> if user dont have access', done => {

})

it('creates component if user have access', done => {

})
const gotRedirect = {
path: inboxPath,
canAccess: accessExceptInbox
}
const component = shallow(<RouteAuth {...gotRedirect} />)
})
5 changes: 2 additions & 3 deletions src/common/components/parts/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ class Header extends React.Component {
content={
<FormattedMessage
id="Header.Popup.HeaderButton"
defaultMessage={`Hello {name}, today is {today, date}`}
defaultMessage={`Hello {name}`}
values={{
name: <b>user</b>,
today: Date.now()
name: <b>user</b>
}}
/>
}
Expand Down

0 comments on commit 39a3358

Please sign in to comment.