Sinon Stub : functions that are called from within another function

Clash Royale CLAN TAG#URR8PPPSinon Stub : functions that are called from within another function
I am trying stub my main function but this function call other function that is inside module.
For example:
MY MODULE
module.exports = {
main,
other
}
function main(val) {
if(other(val)) {
return 'OK'
} else {
return 'KO'
}
}
function other(val) {
return x>1
}
TEST.SPEC
const sinon = require('sinon')
describe(('Test My Module'), () => {
it('I want to get KO', () => {
const myModule = require('myModule')
const stubOther = sinon.stub(myModule, 'other')
stubOther.withArgs(0).returns(true)
console.log(myModule.main(0))
})
})
The other function always is executed and return false. When , actually, I want to get that other function return true.
Can you help me ?
Thanks
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.