• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript assert.ifError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中assert.ifError函数的典型用法代码示例。如果您正苦于以下问题:TypeScript ifError函数的具体用法?TypeScript ifError怎么用?TypeScript ifError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ifError函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: done

        request.get({url:domain+'/files/'+this.file.fileId, json:true}, (err, rs, updated:IFile) => {
          assert.ifError(err)
          assert.equal(rs.statusCode, 200, "Status("+rs.statusCode+"): " + updated)
          assert.equal(updated.name, "asdf", "didn't update. maybe it updated the fileId") // data.txt
          assert.equal(updated.ext, "txt", "changed extension!")
          assert.equal(updated.url, this.file.url)

          this.book.files = [updated]

          // your responsibility to update the book's version
          request.put({url:domain+"/books/"+this.bookId, json:this.book}, (err, rs, body) => {
            assert.ifError(err)
            assert.equal(rs.statusCode, 200, "Status("+rs.statusCode+"): " + body)

            request.get({url:domain+'/books/'+this.bookId+'/files', json:true}, (err, rs, files:IFile[]) => {
              assert.ifError(err)
              assert.equal(rs.statusCode, 200, "Status("+rs.statusCode+"): " + files)
              assert.equal(files.length, 1)
              var updated = files[0]
              assert.equal(updated.name, "asdf", "didn't update. maybe it updated the fileId") // data.txt
              assert.equal(updated.ext, "txt", "changed extension!")
              assert.equal(updated.url, this.file.url)
              done()
            })

          })

        })
开发者ID:emenwin,项目名称:librosapp,代码行数:28,代码来源:files.test.ts


示例2: done

 request.get({url: domain + '/genres/'+this.book.genre+'/books', json:true}, (err, rs, books:IBook[]) => {
   assert.ifError(err)
   assert.equal(rs.statusCode, 200)
   assert.equal(books[0].genre, this.book.genre)
   assert.ok(books.filter((book:IBook) => book.bookId == this.book.bookId).length)
   done()
 })
开发者ID:emenwin,项目名称:librosapp,代码行数:7,代码来源:genres.test.ts


示例3: function

 bq.createJob({}, function(err, job, resp) {
   assert.ifError(err);
   assert.strictEqual(job, fakeJob);
   assert.strictEqual(job.metadata, RESPONSE);
   assert.strictEqual(resp, RESPONSE);
   done();
 });
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:7,代码来源:index.ts


示例4: walkTest

	export async function walkTest() {
		const dirs: string[] = []
		const files: string[] = []
		await new fileSystem.FileSystem().walk(".", {
			other() {

			},
			error(e) {
				assert.ifError(e)
			},
			dir(p) {
				dirs.push(path.relative(root, p).replace(/\\/g, "/"))
			},
			file(p) {
				files.push(path.relative(root, p).replace(/\\/g, "/"))
			},
			walkDir() {

			}
		})
		assert.deepStrictEqual(dirs.sort(), ["", "dir1", "dir1/sub1", "dir1/sub2", "dir2"])
		assert.deepStrictEqual(files.sort(), ["dir1/sub1/f3.txt", "dir1/sub1/f4.txt", "dir1/sub2/f5.txt", "f1.txt", "f2.txt"])

		await new fileSystem.FileSystem().walk("404", {})
	}
开发者ID:tpack,项目名称:utilskit,代码行数:25,代码来源:fileSystem.test.ts


示例5: done

 api.wait(brk, err2 => {
   assert.ifError(err2);
   const frame = brk.stackFrames[0];
   const args = frame.arguments;
   const locals = frame.locals;
   // TODO: Determine how to remove these casts to any.
   ctxMembers = brk.variableTable.slice(brk.variableTable.length - 1)[0]!
     .members;
   assert.deepStrictEqual(
     ctxMembers!.length,
     1,
     'There should be one member in the context variable value'
   );
   assert.deepStrictEqual(ctxMembers![0], {name: 'a', value: '10'});
   assert.strictEqual(args.length, 0, 'There should be zero arguments');
   if (utils.satisfies(process.version, '>=11')) {
     assert.strictEqual(locals.length, 3, 'There should be three locals');
     assert.deepStrictEqual(locals[0].name, 'this');
     assert.deepStrictEqual(locals[1], {name: 'b', value: '1'});
     assert.deepStrictEqual(locals[2].name, 'context');
   } else {
     assert.strictEqual(locals.length, 2, 'There should be two locals');
     assert.deepStrictEqual(locals[0], {name: 'b', value: '1'});
     assert.deepStrictEqual(locals[1].name, 'context');
   }
   api.clear(brk, err3 => {
     assert.ifError(err3);
     done();
   });
 });
开发者ID:GoogleCloudPlatform,项目名称:cloud-debug-nodejs,代码行数:30,代码来源:test-this-context.ts


示例6: assert

    api.set(bp, err => {
      assert.ifError(err);
      api.wait(bp, err => {
        assert.ifError(err);
        const exp = bp.evaluatedExpressions[0];
        assert(exp);
        const varIndex = exp!.varTableIndex;
        assert(varIndex);
        const members = bp.variableTable[varIndex!]!.members;
        assert(members);
        for (const entry of members!) {
          if (entry.name === 'title') {
            assert(entry.value === undefined);
          }
        }

        api.clear(bp, err => {
          assert.ifError(err);
          done();
        });
      });
      process.nextTick(() => {
        code.foo();
      });
    });
开发者ID:GoogleCloudPlatform,项目名称:cloud-debug-nodejs,代码行数:25,代码来源:test-expression-side-effect.ts


示例7: function

 fs.readFile(this.file.url.replace(localFileMatch[0], ""), function(err, body) {
   assert.ifError(err)
   var asdf = body.toString()
   assert.ok(asdf.match('data'))
   done()
   
   })
开发者ID:emenwin,项目名称:librosapp,代码行数:7,代码来源:files.test.ts


示例8: function

        table.createLoadJob(file, function(err, job) {
          assert.ifError(err);

          job.on('error', done).on('complete', function() {
            done();
          });
        });
开发者ID:brgmn,项目名称:nodejs-bigquery,代码行数:7,代码来源:bigquery.ts



注:本文中的assert.ifError函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript assert.isTrue函数代码示例发布时间:2022-05-25
下一篇:
TypeScript assert.fail函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap