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
23 changes: 4 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: CI


on:
push:
branches: [main]
pull_request:
branches: [main]

Expand All @@ -22,25 +21,11 @@ jobs:
- name: Install dependencies
run: npm install

- name: Run ESLint
run: npm run lint

- name: Build TypeScript
run: npm run build

- name: Run Tests with Vitest
run: npm run test

- name: Run ESLint
run: npm run lint

# FOR IT TO WORK WITH GITHUB Actions and push to Docker registry do the following
# In your repo settings, go to Settings → Secrets and variables → Actions → Secrets, and add:
# DOCKER_USERNAME – your Docker Hub username
# DOCKER_PASSWORD – a Docker Hub personal access token

# - name: Log in to Docker Hub
# run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

# - name: Build Docker image
# run: docker build -t ${{ secrets.DOCKER_USERNAME }}/iot-app:latest .

# - name: Push Docker image to Docker Hub
# run: docker push ${{ secrets.DOCKER_USERNAME }}/iot-app:latest
17 changes: 17 additions & 0 deletions src/test/toggleled.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { describe, it, expect } from "vitest";
import { toggle_led } from "../toggleLed";

describe("toggle_led", () => {
it("returns true if led state was false", () => {
expect(toggle_led(false)).toBe(true);
});

it("returns false if led state was true", () => {
expect(toggle_led(true)).toBe(false);
});


it("Fails test", () => {
expect(toggle_led(true)).toBe(true);

Check failure on line 15 in src/test/toggleled.test.ts

View workflow job for this annotation

GitHub Actions / build-and-test

src/test/toggleled.test.ts > toggle_led > Fails test

AssertionError: expected false to be true // Object.is equality - Expected + Received - true + false ❯ src/test/toggleled.test.ts:15:30
});
});
3 changes: 3 additions & 0 deletions src/toggleLed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function toggle_led(led_state: boolean): boolean {
return !led_state;
}
Loading