This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 - Go to the project and edit the Dockerfile inside the cypress folder. | |
2 - Remove last command to run tests and make sure the last command is the build | |
3 - Got to the root of the project and run: docker build . -f ./cypress/Dockerfile -t meta-front-end:dev | |
4 - To run the cypress tests run this command: docker run -v ${PWD}/cypress:/app/cypress --rm meta-front-end:dev npm run test-prod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const { requestAdvice, responseAdviceFailure, responseAdviceSuccess} = createActions({}, | |
'REQUEST_ADVICE', | |
'RESPONSE_ADVICE_FAILURE', | |
'RESPONSE_ADVICE_SUCCESS', | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('renders random advice', () => { | |
const app = shallow(<App advice='Random Advice' fetching={false} />); | |
console.log("HERE", app.debug()); | |
expect(app.instance().defineLabelAdvice()).toEqual('This is a random advice'); | |
expect(app).toMatchSnapshot(); | |
}); | |
it('renders input based advice', () => { | |
const app = shallow(<App advice='Input Advice' fetching={false} />); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
import { getRandomAdvice } from './Action'; | |
import './App.css'; | |
class App extends Component { | |
state = { | |
value: "", | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Reducer from './Reducer'; | |
describe('reducer', () => { | |
it('should handle the Action REQUEST_ADVICE', () => { | |
expect( | |
Reducer( | |
{ | |
fetching: false, | |
randomAdvice: null, | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('AsyncActions', () => { | |
beforeAll(() => { | |
mockStore = ReduxMockStore.default(middlewares); | |
initialState = {}; | |
}); | |
beforeEach(() => { | |
fetch.resetMocks(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('AsyncActions', () => { | |
beforeAll(() => { | |
mockStore = ReduxMockStore.default(middlewares); | |
initialState = {}; | |
}); | |
it('Does a getRandomAdvice succeful', () => { | |
fetch.mockResponse(JSON.stringify({slip: { | |
advice: 'Advice' | |
}})); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should create an action of the type success when trying to get a advice', () => { | |
const expectedAction = { | |
type: 'RESPONSE_ADVICE_SUCCESS', | |
payload: { | |
advice: 'Advice', | |
} | |
}; | |
expect(actions.responseAdviceSuccess({advice: 'Advice'})).toEqual(expectedAction); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as actions from './Action'; | |
describe('actions', () => { | |
it('should create an action to request a advice', () => { | |
const expectedAction = { | |
type: 'REQUEST_ADVICE', | |
}; | |
expect(actions.requestAdvice()).toEqual(expectedAction); | |
}); | |
}); |