Fixed tests and types

This commit is contained in:
Gregory Schier 2017-08-22 17:06:56 -07:00
parent 9e3d79ccc0
commit 2887282032
6 changed files with 10 additions and 9 deletions

View File

@ -20,13 +20,13 @@ describe('migrate()', () => {
);
const storedBody = models.response.getBodyBuffer({bodyPath: expectedBodyPath});
// Should have stripped these
expect(newModel.body).toBeUndefined();
expect(newModel.encoding).toBeUndefined();
// Should have set bodyPath and stored the body
expect(newModel.bodyPath).toBe(expectedBodyPath);
expect(storedBody + '').toBe('hello world!');
// Should have stripped these
expect(newModel.body).toBeUndefined();
expect(newModel.encoding).toBeUndefined();
});
it('migrates base64 body correctly', async () => {

View File

@ -99,7 +99,7 @@ export function initModel (type: string, ...sources: Array<Object>) {
created: Date.now()
}, model.init());
const fullObject = Object.assign(objectDefaults, ...sources);
const fullObject = Object.assign({}, objectDefaults, ...sources);
// Generate an _id if there isn't one yet
if (!fullObject._id) {

View File

@ -73,7 +73,9 @@ export default class BaseExtension {
models: {
request: {getById: models.request.getById},
workspace: {getById: models.workspace.getById},
cookieJar: {getOrCreateForWorkspace: models.cookieJar.getOrCreateForWorkspace},
cookieJar: {getOrCreateForWorkspace: workspace => {
return models.cookieJar.getOrCreateForParentId(workspace._id);
}},
response: {
getLatestForRequestId: models.response.getLatestForRequest,
getBodyBuffer: models.response.getBodyBuffer

View File

@ -54,7 +54,7 @@ export default {
case 'url':
return getRequestUrl(context, request);
case 'cookie':
const cookieJar = await context.util.models.cookieJar.getOrCreateForParentId(workspace._id);
const cookieJar = await context.util.models.cookieJar.getOrCreateForWorkspace(workspace);
const url = await getRequestUrl(context, request);
const value = await getCookieValue(cookieJar, url, name);
return value;

View File

@ -9,7 +9,7 @@ import {updateMimeType} from '../../models/request';
import React from 'react';
import autobind from 'autobind-decorator';
import classnames from 'classnames';
import {registerModal, reloadModal, showModal} from './modals/index';
import {registerModal, showModal} from './modals/index';
import AlertModal from './modals/alert-modal';
import ChangelogModal from './modals/changelog-modal';
import CookiesModal from './modals/cookies-modal';

View File

@ -1,6 +1,5 @@
import {createSelector} from 'reselect';
import {fuzzyMatch} from '../../common/misc';
import * as models from '../../models/index';
// ~~~~~~~~~ //
// Selectors //