Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
name: npm test

on:
push:
Expand All @@ -16,6 +16,7 @@ jobs:

strategy:
matrix:
# node-version: [15.x]
node-version: [10.x, 12.x, 14.x, 15.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

Expand All @@ -27,4 +28,5 @@ jobs:
node-version: ${{ matrix.node-version }}
#- run: npm ci
#- run: npm run build --if-present
- run: npm install
- run: npm test
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ Stop the app in regular NodeJS fashion
- Node's Readline Module: https://nodejs.org/api/readline.html
- How to setup Jest: https://amenallah.com/node-js-typescript-jest-express-starter/
- Binary Coversions: https://www.build-electronic-circuits.com/binary-number-system/

testing update
7 changes: 5 additions & 2 deletions src/conversions/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ import { binaryToDecimal, decimalToBinary } from "../index";
describe("Conversion Functions", () => {
it("converts binary string to the correct decimal result", () => {
const binary = "1101100";

expect(binaryToDecimal(binary)).toBe("Decimal Result: 108");
let _fn = jest.fn(binaryToDecimal);
// _fn(binary);
expect(_fn(binary)).toBe("Decimal Result: 108");
expect(_fn).toHaveBeenCalled();
});

it("converts decimal input (of type string) to the correct binary result", () => {
const decimal = "108";

expect(decimalToBinary(decimal)).toBe("Binary Result: 1101100");
});

});