0
나는이 자바 스크립트 코드가 있습니다자바 스크립트 : aparently 같은 값이 결과로 주장 다른
const BaseList = {
new: function(list) {
this.list = list;
return this;
},
sortKeys: function(key) {
const keys = Object.keys(this.list);
keys.push(key);
keys.sort();
return keys;
}
}
module.exports = BaseList;
내가 모카/어설이 일을 함께 sortKeys
을 테스트입니다을 :
describe('#sortKeys', function() {
it('should insert a new key in order', function() {
const par = {'a': 'test_a', 'c': 'test_c'};
const bl = BaseList.new(par);
const sl = bl.sortKeys('b');
assert.equal(sl,['a','b','c']);
});
});
내 테스트임을 발생 실패 메시지가 표시됩니다 :
AssertionError [ERR_ASSERTION]: [ 'a', 'b', 'c' ] == [ 'a', 'b', 'c' ]
우리는 동일한 배열이지만 어설 션은 서로 다르다고합니다.
무엇이 여기에 있습니까?
대단히 감사합니다! –