Skip to content

Instantly share code, notes, and snippets.

View muscaiu's full-sized avatar
🎯
Focusing

Cristian Muscalu muscaiu

🎯
Focusing
View GitHub Profile
//snsihwdihwidhiwdi
@muscaiu
muscaiu / snapshot
Last active January 29, 2019 12:58
import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import Bar from '../Bar';
describe('Bar', () => {
it('should render properly', () => {
const data = 'fake';
const wrapper = shallow(
<Bar data={data} />
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
export default (async function showResults(values) {
await sleep(500); // simulate server latency
window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`);
});
import fetchData from './Api';
describe('API Caller', () => {
it('should call YesNo API', () => {
const fetchSpy = jest.spyOn(global, 'fetch')
.mockImplementation(() => Promise.resolve({
json: () => {},
}));
return fetchData()
import React from 'react';
import createItem from '../createItem';
import { connect } from 'react-redux';
import { selectItem } from '../../selectors/itemSelectors';
jest.resetModules();
jest.mock('react-redux');
const WrappedComponent = () => (<li />);
let mapStateToProps;
//go back as manny commits as you need
git reset --soft HEAD~4
git commit
git push --force origin my_branch
create an empty firebase-messaging-sw.js inside the public folder
node node_modules\eslint\bin\eslint.js --fix app/**
sudo -i -u couchdb /home/couchdb/bin/couchdb
const { sortBy, orderBy } = require('lodash');
const filteredGames = [
{ name: 'game2', discountActive: 1, price: 5, priceDiscounted: 4 },
{ name: 'game6', discountActive: 1, price: 20, priceDiscounted: 8 },
{ name: 'game5', discountActive: 0, price: 10, priceDiscounted: 9 },
{ name: 'game3', discountActive: 0, price: 11, priceDiscounted: 10 },
{ name: 'game4', discountActive: 1, price: 22, priceDiscounted: 17 },
{ name: 'game1', discountActive: 0, price: 21, priceDiscounted: 18 },
];