Add unit tests for storage, settings and achievements
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 78/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- testing
調査の方向性
Start with shared/storage.ts, shared/settings.ts, and shared/achievements.ts at the listed lines, then check the project’s package scripts and CI setup to find how tests should run. Add a Node test environment with an in-memory localStorage stub and cover the listed cases, including the reset behavior. Done when the tests pass in CI and the issue’s acceptance cases are covered.
索引モデルが issue の本文から書いたものです。
説明
Summary
The three modules that hold all persisted player data (high scores, settings, trophies, stats) are Phaser-free and have no tests.
Where
shared/storage.ts:4-30shared/settings.ts:55-78shared/achievements.ts:91,shared/achievements.ts:100-167
Suggested fix
Use a node environment with an in-memory localStorage stub and vi.resetModules() plus a dynamic import per test, because settings and achievements read storage at import.
Storage
-
loadJSONreturns the fallback when nothing is stored, when storage is unavailable or throws, and on invalid JSON -
saveJSONwrites under thegh-arcade:prefix and swallows a throwingsetItem -
submitHighScore: 10 is a record, 10 again is not, 9 is not, 11 is; 0 on a fresh game is not
Settings
- Defaults;
reducedMotionfollowsmatchMedia - A stored partial merges over defaults
-
updateSettingspersists, notifies each listener once and returns the new object; unsubscribe works -
resetSettingsrestores defaults and notifies
Achievements
-
unlockof an unknown id returns false; a known id returns true once - The tenth unlock grants the collection trophy; the collection trophy itself is not counted
-
addCounterunlocks exactly at the target -
recordPlayaccumulates plays, best and total score - The "play every game" trophy unlocks only after every game has a play
-
drainRecentUnlocksreturns new trophies once - After
resetTrophies, nothing is unlocked anddrainRecentUnlocks()is empty (fails today)
Acceptance criteria
- The cases above pass in CI
Getting started
- Relevant files:
shared/storage.ts,shared/settings.ts,shared/achievements.ts - Run locally:
npm install, thennpm run dev - Checks:
npm run typecheckandnpm run build(there is no test suite yet) - Related docs:
README.md
Filed by repo-audit/full-audit at b001f5d. Severity: medium. Effort: M. audit-key: testing|shared/achievements.ts|unlock
- 主要言語
- TypeScript
- スター
- 3
- フォーク
- 3
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TMHSDigital/GH-Arcade のほかの issue
-
enhancement good first issue severity: low
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
TMHSDigital/GH-Arcade#50 ·
-
enhancement good first issue severity: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
TMHSDigital/GH-Arcade#47 ·
-
documentation good first issue severity: low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TMHSDigital/GH-Arcade#34 ·
-
documentation good first issue severity: low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TMHSDigital/GH-Arcade#33 ·
-
dependencies good first issue severity: low
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
TMHSDigital/GH-Arcade#27 ·
TMHSDigital/GH-Arcade の issue をすべて見る
似ている issue
-
automated-triage type/bug type/ci
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
📦 expo-router Android contributor: external needs review sdk-58 severity: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Translate the READMEオープンdocumentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
asasemahmed/openboard#68 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
Document PowerShell shell semantics and read-only Bash deduplication in Built-in Tools referenceオープンdocumentation
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100