Skip to content

Commit

Permalink
Try all node versions
Browse files Browse the repository at this point in the history
  • Loading branch information
zhendrikse committed Oct 21, 2023
1 parent f1aa156 commit 502b51a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ jobs:
npm test
working-directory: kata-solutions/vending-machine/vending-machine-typescript
steps:
- name: Babysteps timer kata typescript with ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: |
npm ci
npm test
working-directory: kata-solutions/babysteps-timer/babysteps-typescript
- name: Vending machine kata Javascript with ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"precompile": "rimraf --glob src/**/*.js spec/**/*.js",
"compile": "tsc",
"pretest": "rimraf --glob src/*.js spec/*.js",
"test": "nyc --reporter=html mocha -r ts-node/register -r jsdom-global/register -r source-map-support/register spec/*.spec.ts",
"test": "nyc --reporter=html mocha --timeout 122000 -r ts-node/register -r jsdom-global/register -r source-map-support/register spec/*.spec.ts",
"serve": "npx http-server -a 0.0.0.0 -p 8088 -o babystep.html",
"watch": "nodemon --exec nyc --reporter=text --reporter=html mocha -r ts-node/register -r jsdom-global/register -r source-map-support/register spec/*.spec.ts"
"watch": "nodemon --exec nyc --reporter=text --reporter=html mocha --timeout 122000 -r ts-node/register -r jsdom-global/register -r source-map-support/register spec/*.spec.ts"
},
"license": "MIT",
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,23 @@ describe("A new babysteps timer", function() {
command("stop")
})

it("h1 contains the time", function() {
it("h1 contains the time", function(): void {
expect(document.querySelector("h1")?.innerHTML).to.equal("02:00")
})

it("time ticks back over time", async() => {
it("time ticks back over time", async(): Promise<void> => {
await fakeClock.nextCurrentTimeValueIs(0.75)
expect(document.querySelector("h1")?.innerHTML).to.equal("01:59")
})

it("time ticks back over longer time", async() => {
it("time ticks back over longer time", async(): Promise<void> => {
await fakeClock.nextCurrentTimeValueIs(1.75)
expect(document.querySelector("h1")?.innerHTML).to.equal("01:58")
})

it("resets when time has passd beyond the expiry time", async(): Promise<void> => {
// await fakeClock.nextCurrentTimeValueIs(121)
expect(document.querySelector("h1")?.innerHTML).to.equal("02:00")
})
})

Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export function command(arg: string, clock: RealClock = new RealClock()): void {
}
else if (args.Url.AbsoluteUri == "command://stop/") {
_timerRunning = false;
_lastRemainingTime = "";
clearInterval(_threadTimer)
document.body.innerHTML = CreateTimerHtml(getRemainingTimeCaption(0), BackgroundColorNeutral, false);

Expand Down
4 changes: 2 additions & 2 deletions tdd-katas/babysteps-timer/babysteps-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"precompile": "rimraf --glob src/**/*.js spec/**/*.js",
"compile": "tsc",
"pretest": "rimraf --glob src/*.js spec/*.js",
"test": "nyc --reporter=html mocha -r ts-node/register -r jsdom-global/register -r source-map-support/register spec/*.spec.ts",
"test": "nyc --reporter=html mocha --timeout 122000 -r ts-node/register -r jsdom-global/register -r source-map-support/register spec/*.spec.ts",
"serve": "npx http-server -a 0.0.0.0 -p 8088 -o babystep.html",
"watch": "nodemon --exec nyc --reporter=text --reporter=html mocha -r ts-node/register -r jsdom-global/register -r source-map-support/register spec/*.spec.ts"
"watch": "nodemon --exec nyc --reporter=text --reporter=html mocha --timeout 122000 -r ts-node/register -r jsdom-global/register -r source-map-support/register spec/*.spec.ts"
},
"license": "MIT",
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function command(arg: string): void {
}
else if (args.Url.AbsoluteUri == "command://stop/") {
_timerRunning = false;
_lastRemainingTime = "";
clearInterval(_threadTimer)
document.body.innerHTML = CreateTimerHtml(getRemainingTimeCaption(0), BackgroundColorNeutral, false);

Expand Down

0 comments on commit 502b51a

Please sign in to comment.