本文介紹了如何測試一個值是否“大于或等于"?在茉莉花?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我想確認一個值是小數(或0),所以數字應該大于等于0并且小于1.
I want to confirm that a value is a decimal (or 0), so the number should be greater than or equal to zero and less than 1.
describe('percent',function(){
it('should be a decimal', function() {
var percent = insights.percent;
expect(percent).toBeGreaterThan(0);
expect(percent).toBeLessThan(1);
});
});
如何模仿>= 0"?
推薦答案
你只需要先運行比較操作,然后檢查它是否為真.
You just need to run the comparison operation first, and then check if it's truthy.
describe('percent',function(){
it('should be a decimal',function(){
var percent = insights.percent;
expect(percent >= 0).toBeTruthy();
expect(percent).toBeLessThan(1);
});
});
這篇關于如何測試一個值是否“大于或等于"?在茉莉花?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!