Skip to content

Instantly share code, notes, and snippets.

@isabolic
Created January 2, 2018 14:38
Show Gist options
  • Select an option

  • Save isabolic/153ac7dcd38e8536e782aa3cb26c34e3 to your computer and use it in GitHub Desktop.

Select an option

Save isabolic/153ac7dcd38e8536e782aa3cb26c34e3 to your computer and use it in GitHub Desktop.
SmallestIntegerFinder.js
class SmallestIntegerFinder {
findSmallestInt(args) {
return args.sort(function(a, b) {
return a - b;
})[0];
}
}
//test
Test.describe("Smallest Integer Tests", _ => {
Test.it("Fixed Tests", __ => {
var sif = new SmallestIntegerFinder();
Test.assertEquals(sif.findSmallestInt([78,56,232,12,8]),8,'Should return the smallest int 8');
Test.assertEquals(sif.findSmallestInt([78,56,232,12,18]),12,'Should return the smallest int 12');
Test.assertEquals(sif.findSmallestInt([78,56,232,412,228]),56,'Should return the smallest int 56');
Test.assertEquals(sif.findSmallestInt([78,56,232,12,0]),0,'Should return the smallest int 0');
Test.assertEquals(sif.findSmallestInt([1,56,232,12,8]),1,'Should return the smallest int 1');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment