Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. var tape=require("tape");
  2. var isSorted =require("../");
  3. var fixtures=require("./fixtures.json");
  4. function descend(a,b){
  5. return b-a;
  6. }
  7. fixtures.forEach(f => {
  8. tape("sort test",function(t){
  9. t.plan(1);
  10. var expected=f.expected;
  11. var actual=isSorted(f.array,!!f.comparator?descend:null);
  12. t.equals(actual,expected,"expect "+expected+","+"but got "+actual);
  13. })
  14. });
  15. tape("test exceptions",function(t){
  16. t.plan(1);
  17. t.throws(function(){
  18. isSorted({a:1});
  19. },/Array expected, but got object/,"throw test pass");
  20. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement