I have the following scenario in which I have to check that an URL was build correctly provided some query arguments. I do not expect the system to apply an specific order in the rendered URL, so I came with the following test case which I expected to work:
it('test that url is built correctly', function () {
var args = {
arg1: 'value1',
arg1: 'value2'
};
var rendered_url = render_url(args);
expect(rendered_url).to.equal('/my/url?arg1=value1&arg2=value2')
.or.to.equal('/my/url?arg2=value2&arg1=value1')
;
});
I was pretty surprised to the or
chain to not exists as it makes the statement construction process tidy and cozy.
I know I can workaround this in many ways (for example, using satisfy
), but I wonder:
- Whether I cannot find the pattern to achieve in a similar way what I want in the documentation(I have read it thoroughly)...
- ... or whether there exists a good reason to not include this construction in chai...
- ... and whether there exists any other library or script that provides that feature.
Aucun commentaire:
Enregistrer un commentaire