[英]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.