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 api from './api'; | |
export function addPhotos() { /* ... */ } | |
export function fetchPhotos() { | |
return async function(dispatch) { | |
const { data: photos } = await api.fetchPhotos(); | |
dispatch(addPhotos(photos)); | |
}; | |
} |
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 configureMockStore from 'redux-mock-store' | |
import thunk from 'redux-thunk' | |
import * as actions from '../../actions/TodoActions' | |
import * as types from '../../constants/ActionTypes' | |
import fetchMock from 'fetch-mock' | |
import expect from 'expect' // You can use any testing library | |
| |
const middlewares = [thunk] | |
const mockStore = configureMockStore(middlewares) | |
|
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 { mount } from 'enzyme'; | |
import { PhotosContextInner } from './PhotosContext'; | |
describe('PhotosContext', () => { | |
test('fetchPhotos', async () => { | |
const api = { | |
fetchPhotos: () => ({ data: [{ caption: 'photo caption', src: 'src' }] }), | |
}; |
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
const { spawn } = require("child_process"); | |
const fs = require("fs"); | |
const cluster = require("cluster"); | |
const numCPUs = require("os").cpus().length; | |
const scriptFile = './script.sh'; | |
let tasks = []; | |
function runScript(arg) { |
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, { createContext } from "react"; | |
const AuthContext = createContext({}); | |
const { Consumer, Provider } = AuthContext; | |
export class AuthContextProvider extends React.Component { | |
constructor(props) { | |
super(props); |
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
class HelloWorld | |
def say_hello | |
"Hello World!" | |
end | |
end | |
describe HelloWorld do | |
context “When testing the HelloWorld class” do |
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
{ | |
"name": "react-sample-components-library", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", |
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
{ | |
"presets": ["@babel/preset-env", "@babel/preset-react"] | |
} |
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
module.exports = { | |
webpackConfig: { | |
module: { | |
rules: [ | |
{ | |
test: /\.jsx?$/, | |
exclude: /node_modules/, | |
loader: "babel-loader" | |
} | |
] |
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
module.exports = { | |
webpackConfig: { | |
module: { | |
rules: [ | |
{ | |
test: /\.jsx?$/, | |
exclude: /node_modules/, | |
loader: "babel-loader" | |
} | |
] |