Skip to content

Instantly share code, notes, and snippets.

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
export const { requestAdvice, responseAdviceFailure, responseAdviceSuccess} = createActions({},
'REQUEST_ADVICE',
'RESPONSE_ADVICE_FAILURE',
'RESPONSE_ADVICE_SUCCESS',
);
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} />);
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { getRandomAdvice } from './Action';
import './App.css';
class App extends Component {
state = {
value: "",
}
import Reducer from './Reducer';
describe('reducer', () => {
it('should handle the Action REQUEST_ADVICE', () => {
expect(
Reducer(
{
fetching: false,
randomAdvice: null,
},
describe('AsyncActions', () => {
beforeAll(() => {
mockStore = ReduxMockStore.default(middlewares);
initialState = {};
});
beforeEach(() => {
fetch.resetMocks();
});
describe('AsyncActions', () => {
beforeAll(() => {
mockStore = ReduxMockStore.default(middlewares);
initialState = {};
});
it('Does a getRandomAdvice succeful', () => {
fetch.mockResponse(JSON.stringify({slip: {
advice: 'Advice'
}}));
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);
});
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);
});
});