Fix tests

This commit is contained in:
Gregory Schier committed 2016-12-01 09:03:33 -08:00
1 parent cfb4e02e0a
commit d8ca4a360e
7 files changed
+17 -16

No files matched your search

+14 -11
View File
@@ -23,6 +23,7 @@ describe('onChange()', () => {
it('handles change listeners', async () => {
const doc = {
type: models.request.type,
parentId: 'nothing',
name: 'foo'
};
@@ -32,16 +33,17 @@ describe('onChange()', () => {
};
db.onChange(callback);
await db.insert(doc);
await db.insert(doc, true);
const newDoc = await models.request.create(doc);
const updatedDoc = await models.request.update(newDoc, {name: 'bar'});
expect(changesSeen.length).toBe(2);
expect(changesSeen).toEqual([
[[db.CHANGE_INSERT, doc, false]],
[[db.CHANGE_INSERT, doc, true]]
[[db.CHANGE_INSERT, newDoc, false]],
[[db.CHANGE_UPDATE, updatedDoc, false]],
]);
db.offChange(callback);
await db.insert(doc);
await models.request.create(doc);
expect(changesSeen.length).toBe(2);
});
});
@@ -50,6 +52,7 @@ describe('bufferChanges()', () => {
it('properly buffers changes', async () => {
const doc = {
type: models.request.type,
parentId: 'n/a',
name: 'foo'
};
@@ -60,8 +63,8 @@ describe('bufferChanges()', () => {
db.onChange(callback);
db.bufferChanges();
await db.insert(doc);
await db.insert(doc, true);
const newDoc = await models.request.create(doc);
const updatedDoc = await models.request.update(newDoc, true);
// Assert no change seen before flush
expect(changesSeen.length).toBe(0);
@@ -69,15 +72,15 @@ describe('bufferChanges()', () => {
// Assert changes seen after flush
db.flushChanges();
expect(changesSeen).toEqual([[
[db.CHANGE_INSERT, doc, false],
[db.CHANGE_INSERT, doc, true]
[db.CHANGE_INSERT, newDoc, false],
[db.CHANGE_UPDATE, updatedDoc, false]
]]);
// Assert no more changes seen after flush again
db.flushChanges();
expect(changesSeen).toEqual([[
[db.CHANGE_INSERT, doc, false],
[db.CHANGE_INSERT, doc, true]
[db.CHANGE_INSERT, newDoc, false],
[db.CHANGE_UPDATE, updatedDoc, false]
]]);
});
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -1,7 +1,7 @@
{
"private": true,
"name": "insomnia",
"version": "3.8.0",
"version": "4.0.0",
"productName": "Insomnia",
"longName": "Insomnia REST Client",
"description": "A simple and beautiful REST API client",
+1
View File
@@ -325,6 +325,7 @@ class App extends Component {
if (firstLaunch) {
// TODO: Show a welcome message
trackLegacyEvent('First Launch');
trackEvent('General', 'First Launch', getAppVersion());
} else if (lastVersion !== getAppVersion()) {
trackEvent('General', 'Updated', getAppVersion());
showModal(ChangelogModal);
+1 -4
View File
@@ -21,7 +21,7 @@
"build:clean": "rm -rf ./build && rm -rf ./dist && mkdir ./build",
"build:renderer": "cross-env NODE_ENV=production webpack --config ./webpack/webpack.config.production.babel.js",
"build:main": "cross-env NODE_ENV=production webpack --config ./webpack/webpack.config.electron.babel.js",
"build:copy": "cp -r ./app/package.json ./app/static ./build/",
"build:copy": "cp -r ./app/package.json ./app/static ./app/icons/* ./build/",
"build:install": "cd build && npm install",
"build": "npm run build:clean && npm run build:renderer && npm run build:main && npm run build:copy && npm run build:install",
"package:mac": "rm -rf dist/mac && node node_modules/electron-builder/out/build-cli.js --publish=never --x64 --mac",
@@ -74,12 +74,9 @@
"category": "public.app-category.developer-tools",
"compression": "normal",
"mac": {
"icon": "build/static/icon.icns"
},
"win": {
"iconUrl": "https://insomnia.rest/images/icon.png",
"icon": "build/static/icon.ico",
"loadingGif": "build/static/install-spinner.gif",
"__remoteReleases": "https://s3.amazonaws.com/downloads.insomnia.rest/win",
"target": "squirrel",
"msi": false