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

following the "game of life" example, td.verify with _.isEquality

Đang mở
#295 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
testing-qa

Hướng nghiên cứu

Start with the game of life example and the second test shown, then inspect td.verify and _.isEquality behavior for seedWorld and seedWorldSecond. Done means the expected comparison behavior is established with a focused test or a clear explanation of how this case should be verified.

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

Mô tả

Hello.
I'm trying to follow the game of life discovery testing by Justin Searls , with TypeScript.

I added the second test, without changing the code, and it passes:

test('one generation', () => {
    const seedWorld = new World()
    td.when(generatesSeedWorld.generate()).thenReturn(seedWorld)
    const seedWorldSecond = new World()

    simulatesConway.simulate(1, 1337)

    td.verify(outputsWorld.output(seedWorld))
    td.verify(outputsWorld.output(seedWorldSecond))
  })

Because seedWorld is at this moment exactly the same as seedWorldSecond (although it is not THE SAME one). When I added this.random = Math.random() to World constructor, the test properly failes.
I'm trying to understand the principle behind this kind of testing, which should not be language/framework specific as far as I understand.

How would you write a test like this then, in testdouble? Should I somehow force a different comparison mode? For now for learning purposes I'm going to leave the random there, but "there must be a better way" ;-)

Thanks a lot!

Ngôn ngữ chính
JavaScript
Star
1.4k
Fork
140
Merge trung bình
5 giờ 55 phút
Pull request đã merge (30 ngày)
4

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 testdouble/testdouble.js

Tất cả issue của testdouble/testdouble.js

Issue tương tự

Thêm issue về JavaScript

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.