MEP单元测试

#空值测试

should return empty string
D:\workspace\math-expression-parse\test\test.js
expect(parse({}, "")).to.equal('')

#普通使用

jsStr 张三
should return 张三
D:\workspace\math-expression-parse\test\test.js
expect(parse({
  "name": "张三"
}, "{name}")).to.equal('张三')

#数学求和sum

should return 3
D:\workspace\math-expression-parse\test\test.js
expect(parse({}, "sum(1,2)")).to.equal(3)

#数学求和sum-2

jsStr sum(20,2)
should return 22
D:\workspace\math-expression-parse\test\test.js
expect(parse({
  "age": 20
}, "sum({age},2)")).to.equal(22)

#条件测试

jsStr condition(80>60,'及格','不及格')
should return 及格
D:\workspace\math-expression-parse\test\test.js
expect(parse({
  "score": 80
}, "condition({score}>60,'及格','不及格')")).to.equal("及格")