我如何编写一个基本的测试类来比较两个数字的值,来测试我编写的最小值验证规则。例如,如果我给出的数字是10,我需要断言9“低于最小值”,而如果数字是11,那么它是可以接受的。
发布于 2017-11-17 14:37:54
下面是一个应该执行检查的函数;如果variable大于10,则测试通过,否则测试失败。
var assert = require('assert');
var variable = 11;
describe('comparison', function() {
describe('#functionName()', function() {
it('should return true when the variable is greater than 10', function() {
assert.equal(true, variable > 10);
});
});
});https://stackoverflow.com/questions/47344474
复制相似问题