diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 675c540..f8a8d7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: CI on: - push: + push: # branches: [main] pull_request: branches: [main] @@ -28,7 +28,7 @@ jobs: - name: Run Tests with Vitest run: npm run test - - name: Run ESLint + - name: Run ESLint # run: npm run lint # FOR IT TO WORK WITH GITHUB Actions and push to Docker registry do the following diff --git a/src/temperature.ts b/src/temperature.ts index 3fdc768..3076581 100644 --- a/src/temperature.ts +++ b/src/temperature.ts @@ -1,3 +1,7 @@ export function isOverheating(temp: number): boolean { return temp > 70; } + +export function isUnderheating(temp: number): boolean { + return temp < 0; +} diff --git a/src/test/temperature.test.ts b/src/test/temperature.test.ts index 3f58906..22eeefa 100644 --- a/src/test/temperature.test.ts +++ b/src/test/temperature.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from "vitest"; -import { isOverheating } from "../temperature"; +import { isOverheating, isUnderheating } from "../temperature"; describe("isOverheating", () => { it("returns true if temp is above 70", () => { @@ -10,3 +10,13 @@ describe("isOverheating", () => { expect(isOverheating(70)).toBe(false); }); }); + +describe("isUnderheating", () => { + it("returns true if temp is below 0", () => { + expect(isUnderheating(-5)).toBe(true); + }); + + it("returns false if temp is 0 or above", () => { + expect(isUnderheating(0)).toBe(false); + }); +});