1.9 KiB
1.9 KiB
id, challengeType, forumTopicId, localeTitle
id | challengeType | forumTopicId | localeTitle |
---|---|---|---|
587d824c367417b2b2512c4c | 2 | 301587 | 用 Assert.deepEqual() 和 Assert.notDeepEqual() 断言深度相等 |
Description
deepEqual()
断言两个对象是否 deep equal
Instructions
assert.deepEqual()
或者 assert.notDeepEqual()
来让测试通过。
Tests
tests:
- text: 不应有未通过的测试
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=6').then(data => {assert.equal(data.state,'passed'); }, xhr => { throw new Error(xhr.responseText); })
- text: 请选择正确的断言—deepEqual 或 notDeepEqual
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=6').then(data => { assert.equal(data.assertions[0].method, 'deepEqual', 'The order of the keys does not matter'); }, xhr => { throw new Error(xhr.responseText); })
- text: 请选择正确的断言—deepEqual 或 notDeepEqual
testString: getUserInput => $.get(getUserInput('url') + '/_api/get-tests?type=unit&n=6').then(data => { assert.equal(data.assertions[1].method, 'notDeepEqual', 'The position of elements within an array does matter'); }, xhr => { throw new Error(xhr.responseText); })
Challenge Seed
Solution
/**
Backend challenges don't need solutions,
because they would need to be tested against a full working project.
Please check our contributing guidelines to learn more.
*/