From afb666b387933caaad193d4caa1befb1eef0dfdd Mon Sep 17 00:00:00 2001 From: suven Date: Sun, 21 Aug 2022 10:00:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=AC=AC=E4=B8=80=E5=91=A8?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test.spec.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/test.spec.js b/test/test.spec.js index 3417042..db57955 100644 --- a/test/test.spec.js +++ b/test/test.spec.js @@ -3,7 +3,8 @@ var assert = require('assert') describe('Array', function() { describe('#indexOf()', function() { test('当value不在数组中应当返回-1', function() { - assert.equal(-1, [1, 2, 3]/* 填空题 */) + // 第二个值要与第一个相等 + assert.equal(-1, [1, 2, 3].indexOf(4)) }) }) }) @@ -21,7 +22,7 @@ describe('assert', function () { } } // 修改下面代码使得满足测试描述 - assert.equal(a, b) + assert.deepEqual(a, b) }) test('可以捕获并验证函数fn的错误', function () { @@ -29,6 +30,10 @@ describe('assert', function () { xxx; } // 修改下面代码使得满足测试描述 - fn() + // assert.throws(fn()) + assert.throws( + () => { fn() }, + Error + ); }) }) \ No newline at end of file