From 0efcc1c6967fdc4c78f25990625deeabcd4ae4dd Mon Sep 17 00:00:00 2001 From: songxiulin Date: Tue, 16 Aug 2022 22:25:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test.spec.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/test.spec.js b/test/test.spec.js index 3417042..f7faf57 100644 --- a/test/test.spec.js +++ b/test/test.spec.js @@ -1,9 +1,9 @@ var assert = require('assert') -describe('Array', function() { - describe('#indexOf()', function() { - test('当value不在数组中应当返回-1', function() { - assert.equal(-1, [1, 2, 3]/* 填空题 */) +describe('Array', function () { + describe('#indexOf()', function () { + test('当value不在数组中应当返回-1', function () { + assert.equal(-1, [1, 2, 3].indexOf(4)) }) }) }) @@ -21,14 +21,16 @@ describe('assert', function () { } } // 修改下面代码使得满足测试描述 - assert.equal(a, b) + assert.deepEqual(a, b) }) test('可以捕获并验证函数fn的错误', function () { function fn() { - xxx; + throw new Error('出错了') + // xxx; } // 修改下面代码使得满足测试描述 - fn() + assert.throws(fn, Error) + // fn() }) }) \ No newline at end of file