chore(xod-project): update chai to latest 4.1.2 version, fix few tests (breaking changes + some tests falsy passed in the past)

This commit is contained in:
Kirill Shumilov
2017-11-22 13:55:11 +03:00
parent 2f6f52b01a
commit 4e52e9a72b
4 changed files with 9 additions and 11 deletions

View File

@@ -23,7 +23,7 @@
"xod-func-tools": "^0.15.0"
},
"devDependencies": {
"chai": "^3.5.0",
"chai": "^4.1.2",
"dirty-chai": "^1.2.2",
"documentation": "^4.0.0-beta12"
}

View File

@@ -1,6 +1,6 @@
import R from 'ramda';
import { Either } from 'ramda-fantasy';
import chai, { expect } from 'chai';
import chai, { assert } from 'chai';
import dirtyChai from 'dirty-chai';
import * as Helper from './helpers';
@@ -9,7 +9,7 @@ chai.use(dirtyChai);
describe('Helpers', () => {
describe('expectEither', () => {
const leftObj = { name: 'left' };
const leftObj = new Error('LEFT');
const rightObj = { name: 'right' };
// eslint-disable-next-line new-cap
@@ -19,13 +19,11 @@ describe('Helpers', () => {
it('should throw Left value', () => {
const eitherLeft = () => Helper.expectEither(R.identity, left);
expect(eitherLeft).to.throw(leftObj);
assert.throws(eitherLeft, Error, 'LEFT');
});
it('should return Right value', () => {
Helper.expectEither(
(val) => {
expect(val).to.be.equal(rightObj);
},
val => assert.deepEqual(val, rightObj),
right
);
});

View File

@@ -683,11 +683,11 @@ describe('Project', () => {
it('returns Either Error about non-existing patch in the project', () => {
const res = Project.validateProject(project);
const err = new Error(
formatString(CONST.ERROR.TYPE_NOT_FOUND, { patchPath: '@/not-existing-patch' })
formatString(CONST.ERROR.TYPE_NOT_FOUND, { type: '@/not-existing-patch' })
);
assert.equal(res.isLeft, true);
assert.deepEqual(unfoldLeft(res), err);
assert.strictEqual(unfoldLeft(res).message, err.message);
});
it('returns Either Error about missing pins', () => {
const newPatch = Helper.defaultizePatch({});
@@ -700,7 +700,7 @@ describe('Project', () => {
const err = new Error(CONST.ERROR.PINS_NOT_FOUND);
assert.equal(res.isLeft, true);
assert.deepEqual(unfoldLeft(res), err);
assert.strictEqual(unfoldLeft(res).message, err.message);
});
it('returns Either Project for valid project', () => {
const validProject = Helper.defaultizeProject({});

View File

@@ -2062,7 +2062,7 @@ chai@^3.5.0:
deep-eql "^0.1.3"
type-detect "^1.0.0"
chai@^4.0.0, chai@^4.1.0, chai@^4.1.1:
chai@^4.0.0, chai@^4.1.0, chai@^4.1.1, chai@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/chai/-/chai-4.1.2.tgz#0f64584ba642f0f2ace2806279f4f06ca23ad73c"
dependencies: