Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add unit test for useDemosWorkspaceLoader

Đang mở Phù hợp với người mới
#752 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu với lua-learning-website/src/hooks/useExamplesWorkspaceLoader.test.ts và so sánh nó với src/hooks/useDemosWorkspaceLoader.ts. Thêm tệp kiểm thử tương ứng tại lua-learning-website/src/hooks/useDemosWorkspaceLoader.test.ts, bao quát việc resolve, dọn dẹp trạng thái pending, ngăn trùng lặp và hủy khi unmount; chạy các kiểm thử hook để xác nhận tính tương đương.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

tech-debt

Background

PR #751 added src/hooks/useDemosWorkspaceLoader.ts as a near-verbatim parallel of useExamplesWorkspaceLoader.ts, but did not ship the corresponding test file. The reviewer flagged this as tech debt:

The parallel `useExamplesWorkspaceLoader.ts` has an accompanying `useExamplesWorkspaceLoader.test.ts`, but no equivalent `useDemosWorkspaceLoader.test.ts` was added. The code is a near-verbatim copy of the existing pattern so risk is low, but the test-value-parity with the template it was copied from isn't upheld.

Scope

Create lua-learning-website/src/hooks/useDemosWorkspaceLoader.test.ts mirroring useExamplesWorkspaceLoader.test.ts. Coverage should include:

  • Loader resolves and appends the demos workspace to state
  • Pending set has demos removed after resolution
  • Duplicate add is guarded (workspace already present)
  • Cancellation on unmount

Files

  • New: lua-learning-website/src/hooks/useDemosWorkspaceLoader.test.ts
  • Template: lua-learning-website/src/hooks/useExamplesWorkspaceLoader.test.ts

Also consider adding tests for demosFetcher.ts and createDemosWorkspace / fetchAndCreateDemosWorkspace in workspaceManagerHelpers.ts if the Examples counterparts have dedicated coverage.

Risk

Low — the code is a near-verbatim copy of a tested template. This is a test-parity tech-debt item, not a behavior fix.

Ngôn ngữ chính
TypeScript
Star
1
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của jcollard/LuaInTheWeb

Tất cả issue của jcollard/LuaInTheWeb

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.