Skip to content

Instantly share code, notes, and snippets.

View ricca509's full-sized avatar

Riccardo Coppola ricca509

View GitHub Profile
@ricca509
ricca509 / snapshot-serialisable.js
Last active February 22, 2017 11:01
snapshot-serialisable.js
describe('Snapshot tests', () => {
it('work with objects', () => {
expect({
a: 234,
b: 'test',
c: null,
d: undefined,
}).toMatchSnapshot();
});
@ricca509
ricca509 / snapshot-serialisable-result.snap
Last active February 22, 2017 11:02
snapshot-serialisable-result.snap
exports[`Snapshot tests work with arrays 1`] = `
Array [
"a",
5,
[Function],
]
`;
exports[`Snapshot tests work with objects 1`] = `
Object {
import { createElement, createContext, useReducer, useContext } from "react";
const Context = createContext();
export const ContextProvider = Context.Provider;
export const useStore = (reducer, initialState = {}) => {
const [state, dispatch] = useReducer(reducer, initialState);
const getState = () => state;