有没有好的这方面的例子求推荐,谢谢
用这个库包。 restspec 具体的写法参考这个。绝对简单 https://github.com/open-node/open-rest-es6-boilerplate
有问题随时问我。
@stonephp 谢谢
@stonephp 额 有其他的吗 相对比对比
@rwing 其他的你搜索测试相关的东西应该能找到很多,写起来都比我这个复杂很多。
for example:
/* jslint node: true */ 'user strict'; var chai = require('chai'); var app = require('../server'); var request = require('supertest'); chai.should(); var postData = { appId: 1, stamp: 20151010172847, userId: 11078, proType: 1, data: '', sign: 1 }; describe("测试Base2Pro类的接口", function() { describe("#/v1/base2pro/data/transmit", function() { describe("天气推送 —— checkWeatherPush", function () { it("正常参数输入时,返回码为200", function(done) { request(app) .post('/v1/base2pro/data/transmit?lat=40.227932&lon=116.160439&handleType=CheckWeatherPush') .send(postData) .expect(200, done); }); }); describe("水电量 —— getWasherCost", function () { it("正常参数输入时,返回码为200", function(done) { request(app) .post('/v1/base2pro/data/transmit?handleType=GetWasherCost&time=20151023&applianceId=17592195755496&resultType=2&expendType=1') .send(postData) .expect(200, done); }); }); }); });
@qxl1231 谢谢
https://github.com/avajs/ava
import test from 'ava'; test(t => { t.deepEqual([1, 2], [1, 2]); });
CNode 社区为国内最专业的 Node.js 开源技术社区,致力于 Node.js 的技术研究。
用这个库包。 restspec 具体的写法参考这个。绝对简单 https://github.com/open-node/open-rest-es6-boilerplate
有问题随时问我。
@stonephp 谢谢
@stonephp 额 有其他的吗 相对比对比
@rwing 其他的你搜索测试相关的东西应该能找到很多,写起来都比我这个复杂很多。
for example:
@qxl1231 谢谢
https://github.com/avajs/ava