[英]ImmutableJS fromJS() and Map() “ownerID” doesn't match
我正在使用chai-immutable
npm模块进行测试。 这是测试:
it("runs the test", () => {
const initialState = Map();
const entries = ["entry"];
const nextState = setEntries(initialState, entries);
expect(nextState).to.equal(fromJS({
entries : ["entry"]
}));
});
这是setEntries
函数
export function setEntries(state, entries) {
return state.set("entries", List(entries));
}
这个ownerID
是什么? 如何解决这个问题?
编辑:
我已经从头开始创建并重写了整个文件,并且可以正常工作。 它与先前文件完全相同。
仍对发生的原因感兴趣...
调用测试运行程序时,您是否在某处有这段代码?
import chai from 'chai';
import chaiImmutable from 'chai-immutable';
chai.use(chaiImmutable);
通常,您会在文件中使用它,例如test/test-config.js
,然后像这样调用您的跑步者: mocha --compilers js:babel-core/register --require ./test/test-config.js --recursive
(我假设您需要babel编译器,但是重要的部分是--require ./test/test-config.js )
我用Immutable.is()解决了这个问题
expect(is(
nextStat,
fromJS({entries : ["entry"]})
)).to.equal(true)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.