testing - How to use 'OR' with Mocha / Chai -


i trying test if text has text1 or text2. like:

expect(text).to.contain.text1 || expect(text).to.contain.text2. 
  • there not .or
  • any doesn't work because .text() doesn't allow me do:

    expect(text).to.contain.any.text(text1,text2)

  • no, doesn't work: expect(text).to.contain.text1 || expect(text).to.contain.text2.

any idea ?

thanks.

i think can use .oneof(list) or .satisfy(function).

for example,

expect(text).to.be.oneof(['hello', 'world']); 

or

expect(text).to.satisfy(function (t) {   return t === 'hello' || t === 'world'; }); 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -