Skip to content

Instantly share code, notes, and snippets.

View pahund's full-sized avatar

Patrick Hund pahund

View GitHub Profile
/Users/pahund/.nvm/versions/node/v8.9.4/bin/node /Users/pahund/Library/Preferences/IntelliJIdea2018.2/scratches/scratch_59.es6
1
2
3
4
5
6
7
8
9
@pahund
pahund / wallaby-console.log
Created September 7, 2017 13:58
Output from Wallaby.js when running in debug mode
core v1.0.481
Thu, 07 Sep 2017 13:51:29 GMT wallaby:project Wallaby config: /Users/pahund/git/polly/wallaby.js
Thu, 07 Sep 2017 13:51:29 GMT wallaby:project File cache: /Users/pahund/Library/Caches/IntelliJIdea2017.2/wallaby/projects/fc6cd10c264cc385
Thu, 07 Sep 2017 13:51:29 GMT wallaby:uiService Listening port 51235
Thu, 07 Sep 2017 13:51:29 GMT wallaby:project Config file change detected, invalidating local cache
Wallaby App (realtime reports) is available at: http://localhost:51245
Thu, 07 Sep 2017 13:51:29 GMT wallaby:workers Parallelism for initial run: 6, for regular run: 3
Thu, 07 Sep 2017 13:51:29 GMT wallaby:workers Starting run worker instance #0
Thu, 07 Sep 2017 13:51:29 GMT wallaby:workers Starting run worker instance #1
@pahund
pahund / requestPostList.js
Created August 18, 2017 06:15
Code Example for Testing a Redux Saga with Mocha
import { push } from 'react-router-redux';
import { takeLatest, call, put } from 'redux-saga/effects';
import config from '../../../config/client';
import { REQUEST_POST_LIST } from '../actions';
import updatePostList from '../actions/updatePostList';
import fetchPostList from './utils/fetchPostList';
import trackPageViewWithGoogleAnalytics from '../actions/trackPageViewWithGoogleAnalytics';
import trackPageViewWithIvw from '../actions/trackPageViewWithIvw';
export function *requestPostList({ threadId, page }) {
@pahund
pahund / module-structure.txt
Last active July 22, 2017 16:05
The dependency tree of my module under test
BunyanLogstashTcpStream.js
│ // https://nodejs.org/dist/latest-v6.x/docs/api/events.html#events_class_eventemitter
├── import { EventEmitter } from 'events';
│ // https://nodejs.org/dist/latest-v6.x/docs/api/net.html#net_net
├── import net from 'net';
│ // https://www.npmjs.com/package/bunyan
├── import bunyan from 'bunyan';
@pahund
pahund / wallaby-console.log
Created June 23, 2017 14:46
Wallaby Console
wallaby.js started
core v1.0.442
console.error: Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.
Execution progress: 50 tests
Execution progress: 100 tests
Execution progress: 150 tests
Execution progress: 200 tests
Execution progress: 250 tests
Execution progress: 300 tests
Execution progress: 350 tests
@pahund
pahund / wallaby-failing-tests.log
Created June 23, 2017 14:39
Wallaby.js Failing Tests
62 failing tests, 1197 passing
test/server/services/OptimizelyTest.js [server/services/Optimizely] When I instantiate a Optimizely service and the Optimizely API cannot be reached and I call the “fetch” method the “data” property is not set [12 ms]
Error: nope
at setup test/server/services/OptimizelyTest.js:308
at Context.<anonymous> test/server/services/OptimizelyTest.js:217
From console:
(node:12929) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 19)
@pahund
pahund / PageHeaderTest.js
Created May 28, 2017 09:35
Attempt to solve problem of stubbing require.ensure in Mocha unit tests (see https://stackoverflow.com/questions/44114737/how-do-i-stub-webpacks-require-ensure)
/**
* PageHeaderTest.js
*
* (C) 2017 mobile.de GmbH
*
* @author <a href="mailto:pahund@team.mobile.de">Patrick Hund</a>
* @since 28 Mai 2017
*/
import { mount } from 'enzyme';
import React from 'react';
@pahund
pahund / package.json
Created May 27, 2017 16:53
Using “setupTestFrameworkScriptFile” in package.json
"jest": {
"setupTestFrameworkScriptFile": "<rootDir>/test/setup.js",
"moduleNameMapper": {
"\\.scss$": "<rootDir>/test/styleMock.js"
}
}
@pahund
pahund / setup.js
Last active April 20, 2022 04:35
Using Chai and Jest assertions together with Jest's expect (thanks Ruben Oostinga!)
import chai from 'chai';
import sinonChai from 'sinon-chai';
import chaiAsPromised from 'chai-as-promised';
import chaiEnzyme from 'chai-enzyme';
chai.use(sinonChai);
chai.use(chaiAsPromised);
chai.use(chaiEnzyme());
// Make sure chai and jasmine ".not" play nice together
@pahund
pahund / thisWorks.test.js
Created May 27, 2017 16:26
Chai assertions with Jest's expect – this works
describe('the result', () => it('is boolean value false', () => {
expect(result).to.be.a('boolean').and.equal(false);
}));