Skip to content

Commit

Permalink
chore: add tiny coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
webbertakken committed Apr 18, 2024
1 parent 8045c01 commit aa4c930
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"dev": "bun --hot --watch src/main.ts",
"build": "bun build src/main.ts --target=bun --outfile=dist/server.js",
"start": "bun run dist/server.js",
"test": "bun run vitest",
"coverage": "bun vitest --coverage",
"test": "vitest",
"coverage": "vitest --coverage",
"lint": "bun eslint src/ --ext .js,.ts,.tsx,.mts --max-warnings 0",
"format": "bun prettier --write .",
"fix": "bun format && bun run lint --fix",
Expand All @@ -29,7 +29,7 @@
"*.@(ts|tsx|mts)": "bash -c 'bun tsc --skipLibCheck --noEmit'",
"*.@(ts|tsx|mts|js|jsx|mjs|cjs)": [
"bun eslint --max-warnings 0",
"bun vitest related --run"
"vitest related --run"
],
"*.@(ts|tsx|mts|js|jsx|mjs|cjs|json|jsonc|json5|md|mdx|yaml|yml)": "prettier --write"
},
Expand Down
23 changes: 23 additions & 0 deletions src/entity-list.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { describe, expect, it, vi } from 'vitest'

import { EntityList } from './entity-list'
describe('EntityList', () => {
it('compiles', () => {
const hass = {
socket: {
onConnect: vi.fn(),
onDisconnect: vi.fn(),
onUpdate: vi.fn(),
},
}
const logger = { debug: vi.fn(), info: vi.fn() }
const home_automation = {
helper: { doStuff: vi.fn(), theChosenEntity: { onUpdate: vi.fn() } },
}

// @ts-expect-error these are not fully fledged out as this is a quick example
EntityList({ hass, home_automation, logger })
expect(hass.socket.onConnect).toHaveBeenCalledTimes(1)
expect(home_automation.helper.theChosenEntity.onUpdate).toHaveBeenCalledTimes(1)
})
})
7 changes: 0 additions & 7 deletions src/main.spec.ts

This file was deleted.

0 comments on commit aa4c930

Please sign in to comment.