mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 14:19:58 +00:00
Fixed tests and types
This commit is contained in:
parent
9e3d79ccc0
commit
2887282032
@ -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 () => {
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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';
|
||||
|
@ -1,6 +1,5 @@
|
||||
import {createSelector} from 'reselect';
|
||||
import {fuzzyMatch} from '../../common/misc';
|
||||
import * as models from '../../models/index';
|
||||
|
||||
// ~~~~~~~~~ //
|
||||
// Selectors //
|
||||
|
Loading…
Reference in New Issue
Block a user