Skip to content

Instantly share code, notes, and snippets.

View tidusia's full-sized avatar

Thibaud Duthoit tidusia

View GitHub Profile

React new project

Prettier

  • npm i -D prettier
  • package.json scripts: "format": "prettier \"src/**/*.{js,html}\" --write"
  • touch .prettierrc avec : { "trailingComma": "es5" }

JetBrains: Preferences | Languages & Frameworks | JavaScript | Prettier

  • Enable the option Run on save for files.
@tidusia
tidusia / index.js
Created November 21, 2018 09:19
redux-comment-tester-ses-reducers-simplement (should return the initial state FAIL)
export const ACTIONS = {
GET_USER_REQUEST: "GET_USER_REQUEST",
GET_USER_SUCCESS: "GET_USER_SUCCESS",
GET_USER_FAILURE: "GET_USER_FAILURE"
};
export const initialState = {
isFetching: false,
errors: [],
profile: {}
@tidusia
tidusia / how-works-jest.js
Last active November 21, 2018 08:45
redux-comment-tester-ses-reducers-simplement (how work jest)
describe("here name which function or feature you are testing", () => {
it("here explain what specific part of the feature should do", () => {
expect(1 + 1).toBe(2);
});
});
@tidusia
tidusia / snapshot-overkill-simple-snapshot.js
Created January 30, 2018 20:25
Medium Snapshot overkill - Simple AppBar snapshot
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import AppBar from '../';
describe('<AppBar />', () => {
const renderer = new ShallowRenderer();
it('should match snapshot without props', () => {
renderer.render(<AppBar />);
@tidusia
tidusia / snapshot-overkill-appbar.js
Created January 30, 2018 20:20
Medium Snapshot Overkill - Simple AppBar component
import React from 'react';
import PropTypes from 'prop-types';
const AppBar = ({
children,
className,
iconElementLeft,
iconElementRight,
title,
titleStyle,