From 4d0cf39012026ad59cc3bde0ca0d11d0e648d868 Mon Sep 17 00:00:00 2001 From: demin Date: Thu, 18 Aug 2022 11:13:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=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 | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/test/test.spec.js b/test/test.spec.js index 3417042..e3d017c 100644 --- a/test/test.spec.js +++ b/test/test.spec.js @@ -1,34 +1,34 @@ -var assert = require('assert') +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(0) /* 填空题 */); + }); + }); +}); -describe('assert', function () { - test('a和b应当深度相等', function () { +describe("assert", function () { + test("a和b应当深度相等", function () { var a = { c: { - e: 1 - } - } + e: 1, + }, + }; var b = { c: { - e: 1 - } - } + e: 1, + }, + }; // 修改下面代码使得满足测试描述 - assert.equal(a, b) - }) + assert.deepEqual(a, b); + }); - test('可以捕获并验证函数fn的错误', function () { + test("可以捕获并验证函数fn的错误", function () { function fn() { xxx; } // 修改下面代码使得满足测试描述 - fn() - }) -}) \ No newline at end of file + assert.throws(fn); + }); +});