Skip to content

Commit

Permalink
add fix standerd
Browse files Browse the repository at this point in the history
  • Loading branch information
Kachulio1 committed Jan 25, 2019
1 parent 0c87769 commit 9d54dfe
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 52 deletions.
4 changes: 2 additions & 2 deletions cypress/integration/common/web_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ Then(`I should see {string}`, (textToFind) => {
})

Given(`I am at the {string} page`, (pageName) => {
if(pageName === "Home") {
if (pageName === 'Home') {
cy.visit('/')
} else {
cy.fail('unknown page \'' + pageName + '\'')
}
})
})
24 changes: 12 additions & 12 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ module.exports = {
setupTestFrameworkScriptFile: '<rootDir>/src/tests/setupTests.js',
coverageReporters: ['text', 'lcov'],
collectCoverageFrom: [
"**/*.{js,jsx}",
"!**/*.{config}.{js}",
"!**/node_modules/**",
"!**/dist/**",
"!**/vendor/**",
"!**/coverage/**",
"!**/src/assets/**",
"!**/semantic/**",
"!**/src/index.js",
"!**/cypress/**"
'**/*.{js,jsx}',
'!**/*.{config}.{js}',
'!**/node_modules/**',
'!**/dist/**',
'!**/vendor/**',
'!**/coverage/**',
'!**/src/assets/**',
'!**/semantic/**',
'!**/src/index.js',
'!**/cypress/**'
],
testPathIgnorePatterns: [
"<rootDir>/cypress/",
"<rootDir>/node_modules/"
'<rootDir>/cypress/',
'<rootDir>/node_modules/'
],
'transform': {
'^.+\\.js$': 'babel-jest',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"scripts": {
"start": "webpack-dev-server --mode development --open",
"build": "webpack --mode production",
"fix":"standard --fix",
"test": "export NODE_ENV=testing && standard && jest",
"coveralls": "cat ./coverage/lcov.info | coveralls",
"cypress:ci": "cypress run",
Expand Down
31 changes: 15 additions & 16 deletions src/components/navbar/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,48 @@ import logo from '../../images/av-logo.svg'
import './Navbar.css'

export class Navbar extends Component {

currentPath() {
currentPath () {
// this.props.location.split("/") returns ["", ""] when on homepage
// and ["", "users", "123"] when on /users/123
// This function is used to highlight the nav link
const pathArray = this.props.location.pathname.split("/")
const pathArray = this.props.location.pathname.split('/')
return pathArray[1]
}

render() {
render () {
const activeItem = this.currentPath()

return (
<Menu stackable borderless inverted as="div" className="navbar">
<Menu stackable borderless inverted as='div' className='navbar'>
<Container>
<Menu.Item header name="" active={activeItem === ""}>
<Link to="/">
<Menu.Item header name='' active={activeItem === ''}>
<Link to='/'>
<Image src={logo} avatar />
AgileVentures
</Link>
</Menu.Item>

<Menu.Menu position="right">
<Menu.Item name="users" active={activeItem === "users"}>
<Link to="/users">Users</Link>
<Menu.Menu position='right'>
<Menu.Item name='users' active={activeItem === 'users'}>
<Link to='/users'>Users</Link>
</Menu.Item>

<Menu.Item
name="projects"
active={activeItem === "projects"}
name='projects'
active={activeItem === 'projects'}
disabled
>
Projects
</Menu.Item>
<Menu.Item name="events" active={activeItem === "events"} disabled>
<Menu.Item name='events' active={activeItem === 'events'} disabled>
Events
</Menu.Item>

<Menu.Item
name="login"
active={activeItem === "login"}
name='login'
active={activeItem === 'login'}
>
<Link to="/login">Login</Link>
<Link to='/login'>Login</Link>
</Menu.Item>
</Menu.Menu>
</Container>
Expand Down
27 changes: 13 additions & 14 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
const config = {
production: {
AUTH_API: "https://www.agileventures.org/login",
APP_URL: "https://www.agileventures.org/",
API_BASE_URL: "https://www.agileventures.org/"
AUTH_API: 'https://www.agileventures.org/login',
APP_URL: 'https://www.agileventures.org/',
API_BASE_URL: 'https://www.agileventures.org/'
},
staging: {
AUTH_API: "https://staging.websiteone.agileventures.org/login",
APP_URL: "https://staging.websiteone.agileventures.org/",
API_BASE_URL: "https://staging.websiteone.agileventures.org/"
AUTH_API: 'https://staging.websiteone.agileventures.org/login',
APP_URL: 'https://staging.websiteone.agileventures.org/',
API_BASE_URL: 'https://staging.websiteone.agileventures.org/'
},
development: {
AUTH_API: "https://develop.websiteone.agileventures.org/login",
AUTH_API: 'https://develop.websiteone.agileventures.org/login',
APP_URL: `http://localhost:${process.env.PORT}/`,
API_BASE_URL: "https://develop.websiteone.agileventures.org/"
API_BASE_URL: 'https://develop.websiteone.agileventures.org/'
},
testing: {
AUTH_API: "", // Todo add url for testing,
APP_URL: "", // Todo add url for testing,
API_BASE_URL: "" // Todo add url for testing,
AUTH_API: '', // Todo add url for testing,
APP_URL: '', // Todo add url for testing,
API_BASE_URL: '' // Todo add url for testing,
}
};

export default config[process.env.NODE_ENV || 'development'];
}

export default config[process.env.NODE_ENV || 'development']
6 changes: 3 additions & 3 deletions src/helpers/http.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios';
import axios from 'axios'
import config from '../config'

axios.defaults.baseURL = config.API_BASE_URL;
axios.defaults.baseURL = config.API_BASE_URL

export default axios;
export default axios
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ProjectsList from './containers/ProjectsList'
import Homepage from './components/homepage/Homepage'
import Navbar from './components/navbar/Navbar'
import LogIn from './containers/LogIn'
import SignUp from "./containers/SignUp"
import SignUp from './containers/SignUp'
import './assets/semantic.css'

render(
Expand All @@ -21,7 +21,7 @@ render(
<Container className='main-content'>
<Route path='/users' component={UsersList} />
<Route path='/login' component={LogIn} />
<Route path="/signup" component={SignUp} />
<Route path='/signup' component={SignUp} />
<Route path='/projects' component={ProjectsList} />
</Container>
</Switch>
Expand Down
6 changes: 3 additions & 3 deletions src/tests/components/Navbar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { BrowserRouter as Router } from 'react-router-dom'
import { Navbar } from '../../components/navbar/Navbar'

describe('Navbar', () => {
const props = {location: {pathname: "/users"}}
const homepage = (props) => mount(<Router><Navbar {...props}/></Router>)
const props = { location: { pathname: '/users' } }
const homepage = (props) => mount(<Router><Navbar {...props} /></Router>)

describe('renders the Navbar component', () => {
it('renders without errors', () => {
Expand All @@ -28,7 +28,7 @@ describe('Navbar', () => {
expect(wrapper.find('.active').find('Link').length).toEqual(1)
})
it('renders 2 disabled Link element', () => {
//This test can be deleted after all items are working
// This test can be deleted after all items are working
const wrapper = homepage(props)
expect(wrapper.find('.disabled').length).toEqual(2)
})
Expand Down

0 comments on commit 9d54dfe

Please sign in to comment.