Skip to content

Instantly share code, notes, and snippets.

@debugwand
debugwand / jest-mock-module-returnparam.js
Created January 31, 2018 16:46
jest - mock a module and return one of its parameters
jest.mock('../mymodule', () => {
return (opts => { return opts.somecallback; });
});
@debugwand
debugwand / app.jsx
Created March 11, 2016 16:59
Dynamically-created nav built from react routes
import React from 'react';
import { Link } from 'react-router';
export default class App extends React.Component {
render() {
return (
<nav>
<ul>
{
this.props.routes[0].childRoutes.map ( (route) => {
@debugwand
debugwand / pre-commit
Created August 29, 2013 13:59
Running guard-jasmine from a git pre-commit hook with workaround for rvm problems
#!/bin/sh
#
#Run JS tests before commit
echo "LOCAL PRE-COMMIT HOOKS"
if [ -d "$HOME/.rvm/bin" ]; then
PATH="$HOME/.rvm/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
if [ -f ".ruby-version" ]; then
rvm use "$(cat .ruby-version)"