Skip to content

Commit

Permalink
Test and function files are wired together. Test is failing.
Browse files Browse the repository at this point in the history
  • Loading branch information
atom-box committed Dec 3, 2021
1 parent 1e6c88c commit 3804098
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
10 changes: 10 additions & 0 deletions readme-for-TESTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Setting Up
I used NPM.
Refer to https://semaphoreci.com/community/tutorials/getting-started-with-node-js-and-mocha
It was mainly just `npm install --save mocha chai express request `

## Running tests
Once you have some tests in the test directory you just say
`npx mocha --reporter spec`


6 changes: 6 additions & 0 deletions rightDigit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

exports.rightDigit = function(numbers){
console.log('Been to Spain!');
var tuna = 42;
return [111, 222];
}
22 changes: 22 additions & 0 deletions test/rightDigit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Given a list of non-negative integers, return an integer list of the rightmost digits. (Note: use %)
// https://codingbat.com/prob/p152194
// https://semaphoreci.com/community/tutorials/getting-started-with-node-js-and-mocha
console.log('Been to Germany!');

var expect = require("chai").expect;
var thingtotest = require("../rightDigit.js");
console.log('111' + typeof thingtotest.rightDigit);
console.log('222' + Object.keys(thingtotest.rightDigit).toString());
console.log('333' + Object.keys(thingtotest.rightDigit).length);
describe('Digit getter', () => {
it('gets just the last digit of each', () =>{

var blueHex = thingtotest.rightDigit([1, 22, 93]);
expect(blueHex).to.equal([]);
})
});


// rightDigit([1, 22, 93]); // [1, 2, 3]
// rightDigit([16, 8, 886, 8, 1]); // [6, 8, 6, 8, 1]
// rightDigit([10, 0]); // [0, 0]

0 comments on commit 3804098

Please sign in to comment.