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 { mount, getWrapper } = createTestContext({ | |
fixture: { | |
component: Users, | |
fetch: [{ | |
matcher: '/users', | |
response: ['Mary', 'Jason'] | |
}] | |
} | |
}); |
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 createTestContext from 'react-cosmos-test/enzyme'; | |
import fixture from './logged-in.fixture'; | |
const { mount, getWrapper, get } = createTestContext({ fixture }); | |
beforeEach(mount); | |
test('welcomes logged in user by name', () => { | |
expect(getWrapper('.welcome').text()).toContain('Dan'); | |
}); |
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 onReply = jest.fn(); | |
const wrapper = shallow(<UnrealisticComponent onReply={onReply} />) | |
test('kindly asks if everything is alright', () => { | |
expect(wrapper.text()).toBe('Alles gut?') | |
}) | |
test('receives positive response upon click', () => { | |
wrapper.find('button').simulate('click') | |
expect(onReply).toHaveBeenCalledWith('Ja') |
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 fs = require('fs'); | |
const path = require('path'); | |
const glob = require('glob'); | |
const { kebabCase } = require('lodash'); | |
glob | |
.sync('**/*', { ignore: '**/{coverage,node_modules}/**' }) | |
.forEach(filePath => { | |
const pathParts = filePath.split('/'); | |
const fileName = pathParts.pop(); |
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, { Component, PropTypes } from 'react'; | |
import { shallow, mount } from 'enzyme'; | |
class ContextProvider extends Component { | |
getChildContext() { | |
return { | |
foo: 'bar' | |
}; | |
} |
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
git diff HEAD > myprecious.patch | |
mv myprecious.patch ~/Desktop # auto backed on iCloud |
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
index.html | |
+ var domContainer = document.getElementById('content'); | |
+ var rootComponent = Boards.render(getFixtureContents(), domContainer); | |
+ Boards.onRouteChange(function(props) { | |
+ rootComponent = Boards.render(props, domContainer); | |
+ }); | |
boards.js |
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
var times = [ | |
// Dashboard | |
[12.50, 3.41], | |
// Settings | |
[12.04, 3.00], | |
// Mention Stream | |
[11.90, 3.07], | |
[11.90, 4.35], | |
// Signal Stream | |
[11.81, 2.53], |
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
function getTime() { | |
return new Date().getTime() / 1000; | |
} | |
function seconds(time) { | |
return time.toFixed(2) + 's'; | |
} | |
// Start counting as soon as the website loads | |
var startedLoadingAt = getTime(); | |
var loadingTime = 0; | |
var timerInterval = setInterval(function() { |
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
# Refactoring the way "newDataChannels" works, maybe with an alternative | |
# (temporary) "createChannels" method | |
# With current method: | |
[facebook_ad_accounts, | |
facebook_campaigns, | |
facebook_ads] = Utils.newDataChannels( | |
'/facebook-ad-accounts': {} | |
'/facebook-campaigns': {} |
NewerOlder