Example #1
0
 it("should reject non-specs", () => {
   expect(p.isSpec(1)).to.be.false
   expect(p.isSpec({})).to.be.false
   expect(p.isSpec([])).to.be.false
   expect(p.isSpec(null)).to.be.false
   expect(p.isSpec(undefined)).to.be.false
 })
Example #2
0
 it("should identify expr specs", () => {
   expect(p.isSpec({expr: "foo"})).to.be.true
 })
Example #3
0
 it("should identify value specs", () => {
   expect(p.isSpec({value: "foo"})).to.be.true
 })
Example #4
0
 it("should identify field specs", () => {
   expect(p.isSpec({field: "foo"})).to.be.true
   expect(p.isSpec({field: "field"})).to.be.true // check corner case
 })
Example #5
0
 it("should reject bad specs", () => {
   expect(p.isSpec({expr: "foo", value:"bar"})).to.be.false
   expect(p.isSpec({expr: "foo", field:"bar"})).to.be.false
   expect(p.isSpec({field: "foo", value:"bar"})).to.be.false
   expect(p.isSpec({field: "foo", value:"bar", expr: "baz"})).to.be.false
 })