Skip to content

Commit

Permalink
passing all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AnniePawl committed Dec 5, 2019
1 parent 9392f44 commit 842b32d
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -74,3 +74,15 @@ This method returns an integer between specified min and max </br>
This method returns a random hex value </br>
`'randomColor()` &#8594; 8a7f43


## Test Coverage
```
npx jest --coverage
```
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | 100 | 100 | 100 | 100 | |
index.js | 100 | 100 | 100 | 100 | |
----------|----------|----------|----------|----------|-------------------|

4 changes: 2 additions & 2 deletions coverage/clover.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1575492535124" clover="3.2.0">
<project timestamp="1575492535124" name="All files">
<coverage generated="1575493256522" clover="3.2.0">
<project timestamp="1575493256522" name="All files">
<metrics statements="37" coveredstatements="37" conditionals="0" coveredconditionals="0" methods="14" coveredmethods="14" elements="51" coveredelements="51" complexity="0" loc="37" ncloc="37" packages="1" files="1" classes="1"/>
<file name="index.js" path="/Users/annapawl/Desktop/CODE/Make_School/Front_End/JS_Libraries/Math_Library/src/index.js">
<metrics statements="37" coveredstatements="37" conditionals="0" coveredconditionals="0" methods="14" coveredmethods="14"/>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/index.html
Expand Up @@ -80,7 +80,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Dec 04 2019 12:48:55 GMT-0800 (PST)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Dec 04 2019 13:00:56 GMT-0800 (PST)
</div>
</div>
<script src="prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/index.js.html
Expand Up @@ -334,7 +334,7 @@ <h1>
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Dec 04 2019 12:48:55 GMT-0800 (PST)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Dec 04 2019 13:00:56 GMT-0800 (PST)
</div>
</div>
<script src="prettify.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "@annapawl/math_library",
"version": "1.0.0",
"version": "2.0.0",
"description": "![GitHub repo size](https://img.shields.io/github/repo-size/AnniePawl/JS-Math-Library?style=flat-square)</br>",
"main": "index.js",
"directories": {
Expand All @@ -24,4 +24,4 @@
"coveralls": "^3.0.9",
"jest": "^24.9.0"
}
}
}
17 changes: 11 additions & 6 deletions tests/test.js
Expand Up @@ -95,16 +95,21 @@ test('mortgage', () => {

// random(n) Test
// Returns a random integer between 0 and n-1
test('random', (n) => {
expect(Number.random(10) > 10).toBe(false)
expect(Number.random(5) < 5).toBe(true)
test('random', () => {
for (let i = 0; i < 1000; i += 1) {
const n = Number.random(10)
expect(n > 10).toBe(false)
expect(n < 0).toBe(false)
}
})

// randomRange(min, max) Test
// Returns an integer between specified min and max
test('randomRange', (min, max) => {
expect(Number.randomRange(1, 5) > 0 < 5).toBe(true)
expect(Number.randomRange(5, 10) > 4 < 10).toBe(true)
test('randomRange', () => {
for (let i = 0; i < 1000; i += 1) {
expect(Number.randomRange(1, 5) > 0 < 5).toBe(true)
expect(Number.randomRange(5, 10) > 4 < 10).toBe(true)
}
})

// randomColor()
Expand Down

0 comments on commit 842b32d

Please sign in to comment.