t.test('body is object, but too large', function (t) { var conf = { captureBody: 'all' } var req = getMockReq() req.body = { foo: '' } for (var n = 0; n < parsers._MAX_HTTP_BODY_CHARS + 10; n++) { req.body.foo += 'x' } req.headers['content-length'] = JSON.stringify(req.body).length var parsed = parsers.getContextFromRequest(req, conf) t.strictEqual(typeof parsed.body, 'string') t.strictEqual(parsed.body.length, parsers._MAX_HTTP_BODY_CHARS) t.strictEqual(parsed.body.slice(0, 10), '{"foo":"xx') t.end() })
it('should hoist class statics', () => { class Component extends React.Component { static foo = 'bar'; static test() {} } class Wrapper extends React.Component { render() { return <Component />; } } hoistNonReactStatics(Wrapper, Component); expect(Wrapper.foo).toEqual(Component.foo); expect(Wrapper.test).toEqual(Component.test); });
assert.equal(obj.foo('bar'), 'BAR'); }); define(obj, 'bar'); define(obj, 'baz', {}); assert.equal(obj.foo, null); assert.equal(obj.bar, undefined); assert.deepEqual(obj.baz, {}); assert.equal(obj.foo, 'baz'); }); assert.equal(fixture.foo, 'baz'); }); assert.equal(fixture.foo, 'baz'); }); assert.equal(fixture.foo, 'baz'); }); value: 'bar' }); assert.equal(obj.foo, 'bar'); });