Answer the question
In order to leave comments, you need to log in
How to test a feature with Chai/mocha?
Good afternoon, I ran into a problem in testing function arguments.
You need to compare two function arguments. But it throws an error: "Assertion failed: False is expected to be a number or date."
What is the correct way to compare these arguments?
describe("TestingSelectChannel", function () {
it("TVSelectChannelIsAboveThanPermitted", function () {
assert.isAbove(tv.selectChannel(100), tv.selectChannel(99), "Can't be above");
});
});
Answer the question
In order to leave comments, you need to log in
I don’t quite understand why to compare two arguments, if I didn’t understand something, please explain, but I would test this method in this way:
describe("selectChannel method", function () {
const tv = new TV();
tv.power();
it("does not allow selecting channel above 98", function () {
assert.isFalse(tv.selectChannel(100));
});
it("selects provided channel number if it matches requirements", function () {
tv.selectChannel(88)
assert.isEqual(tv._channel, 88);
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question