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 { forOwn, reduce, isPlainObject } from 'lodash'; | |
function validateConfig(config) { | |
if (!isPlainObject(config)) { | |
throw new Error('config must be plain object'); | |
} else if (!isPlainObject(config.storeKeys)) { | |
throw new Error('storeKeys must be plain object'); | |
} | |
} |
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 _ from 'lodash'; | |
import ReactTestUtils from 'react-addons-test-utils'; | |
import { findDOMNode } from 'react-dom'; | |
import { renderToStaticMarkup } from 'react-dom/server'; | |
import reactElementToJSXString from 'react-element-to-jsx-string'; | |
import collapse from 'collapse-white-space'; | |
import shallowQuery from 'react-shallow-query'; | |
let ez = {}; |
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
/* global TEST_FILE,TEST_DIRECTORY */ | |
'use strict'; // eslint-disable-line | |
require('./test-app'); | |
if (TEST_DIRECTORY !== '') { | |
const testsContext = require.context('TEST_DIRECTORY', true); | |
testsContext.keys().forEach(testsContext); | |
} else if (TEST_FILE !== '') { | |
require('TEST_FILE'); // using webpack alias here so TEST_FILE must be a string |
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
QUnit.test('should update folders list when a new folder is created', assert => { | |
assert.expect(3); | |
const done = assert.async(); | |
const data = fixtures.createSuccessResponse('foo'); | |
server.respondWith( | |
'POST', | |
'/test/folders/', | |
[ | |
200, // status code |
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
'should change isLoading when matters fetched'.test(() => { | |
mockStore.dispatch(actions.fetchMatters({ | |
route: 'matters', | |
initial: true, | |
})); | |
mockPromises.tick(); | |
expect(mockStore.getState().mattersView).toEqual({ | |
...mattersViewFixture, | |
fetchStates: 'LOADING', |
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 applyMixin(targetPrototype, obj) { | |
function applyProperty(prop, value) { | |
let descriptor = Object.getOwnPropertyDescriptor(targetPrototype, prop); | |
// Avoid setting properties that are not writable | |
if (descriptor && !descriptor.writable) { | |
return; | |
} | |
Object.defineProperty(targetPrototype, prop, { |
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 { expect } from './testHelpers'; | |
let injector = { | |
_items: new Map(), | |
singleton(name, Value) { | |
const inst = new Value(); | |
this._items.set(name, inst); | |
}, | |
value(name, value) { | |
this._items.set(name, value); |
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
<?php | |
// in application/routes.php | |
Route::post('user', function() | |
{ | |
$data = array('userId' => 1); | |
return Response::make(json_encode($data), 200, | |
array('Content-Type' => 'application/json')); | |
}); | |
Route::get('user', 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
<?php | |
// features/bootstrap/RestContext.php | |
use Behat\Behat\Context\BehatContext; | |
use Symfony\Component\Yaml\Yaml; | |
/** | |
* Rest context. | |
*/ | |
class RestContext extends BehatContext | |
{ |
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
<?php | |
// features/bootstrap/FeatureContext.php testing-rest-api-with-behat/FeatureContext.php | |
use Behat\Behat\Context\ClosuredContextInterface, | |
Behat\Behat\Context\TranslatedContextInterface, | |
Behat\Behat\Context\BehatContext, | |
Behat\Behat\Exception\PendingException; | |
use Behat\Gherkin\Node\PyStringNode, | |
Behat\Gherkin\Node\TableNode; | |
// |
NewerOlder