Search code examples
javascripttypescriptautomationcypressui-automation

javascript assertion between two numbers range


How do I find a assertion for a value between two numbers

let lastArrayAmountValue=50;
assert.equal(lastArrayAmountValue, '5');

I want to assert whether the number is between 5-10 This is the test am doing on cypress.


Solution

  • expect(lastArrayAmountValue).to.be.within(5,10)
    

    https://docs.cypress.io/guides/references/assertions#BDD-Assertions

    looks like that ability is built into cypress