Enforce minimum test coverage (#1646)

## Description:

Enforce minimum test coverage.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [ ] I have read and accepted the CLA agreement (only required once).
This commit is contained in:
Scott Anderson
2025-07-30 22:35:23 -04:00
committed by GitHub
parent c5484696f7
commit ebc0525c89
4 changed files with 9 additions and 11 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ jobs:
with: with:
node-version: 20 node-version: 20
- run: npm ci - run: npm ci
- run: npm test - run: npm run test:coverage
eslint: eslint:
name: 🔍 ESLint name: 🔍 ESLint
+4 -4
View File
@@ -29,10 +29,10 @@ export default {
collectCoverageFrom: ["src/**/*.ts", "!src/**/*.d.ts"], collectCoverageFrom: ["src/**/*.ts", "!src/**/*.d.ts"],
coverageThreshold: { coverageThreshold: {
global: { global: {
branches: 0, statements: 22.2,
functions: 0, branches: 17.5,
lines: 0, lines: 22.7,
statements: 0, functions: 21.2,
}, },
}, },
coverageReporters: ["text", "lcov", "html"], coverageReporters: ["text", "lcov", "html"],
+1 -2
View File
@@ -61,10 +61,9 @@ export function createRenderer(
if (!emojiTable || !(emojiTable instanceof EmojiTable)) { if (!emojiTable || !(emojiTable instanceof EmojiTable)) {
console.error("EmojiTable element not found in the DOM"); console.error("EmojiTable element not found in the DOM");
} }
emojiTable.eventBus = eventBus;
emojiTable.transformHandler = transformHandler; emojiTable.transformHandler = transformHandler;
emojiTable.game = game; emojiTable.game = game;
emojiTable.initEventBus(); emojiTable.initEventBus(eventBus);
const buildMenu = document.querySelector("build-menu") as BuildMenu; const buildMenu = document.querySelector("build-menu") as BuildMenu;
if (!buildMenu || !(buildMenu instanceof BuildMenu)) { if (!buildMenu || !(buildMenu instanceof BuildMenu)) {
+3 -4
View File
@@ -12,12 +12,11 @@ import { TransformHandler } from "../TransformHandler";
@customElement("emoji-table") @customElement("emoji-table")
export class EmojiTable extends LitElement { export class EmojiTable extends LitElement {
@state() public isVisible = false; @state() public isVisible = false;
public eventBus: EventBus;
public transformHandler: TransformHandler; public transformHandler: TransformHandler;
public game: GameView; public game: GameView;
initEventBus() { initEventBus(eventBus: EventBus) {
this.eventBus.on(ShowEmojiMenuEvent, (e) => { eventBus.on(ShowEmojiMenuEvent, (e) => {
this.isVisible = true; this.isVisible = true;
const cell = this.transformHandler.screenToWorldCoordinates(e.x, e.y); const cell = this.transformHandler.screenToWorldCoordinates(e.x, e.y);
if (!this.game.isValidCoord(cell.x, cell.y)) { if (!this.game.isValidCoord(cell.x, cell.y)) {
@@ -40,7 +39,7 @@ export class EmojiTable extends LitElement {
targetPlayer === this.game.myPlayer() targetPlayer === this.game.myPlayer()
? AllPlayers ? AllPlayers
: (targetPlayer as PlayerView); : (targetPlayer as PlayerView);
this.eventBus.emit( eventBus.emit(
new SendEmojiIntentEvent( new SendEmojiIntentEvent(
recipient, recipient,
flattenedEmojiTable.indexOf(emoji), flattenedEmojiTable.indexOf(emoji),