testdouble / testdouble/testdouble.js

td.when breaks after td.replace on objects methods generators

Open
#275 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.4k
Forks
140
Avg merge
22h
Merged PRs (30d)
1

Description

Possibly related to #271.

const Service = {
  *send () {},
}

td.replace(Service, 'send');
td.when(Service.send()).thenResolve('fake');

Running example: https://runkit.com/albertogasparin/595b9e9a08f4860012b4af3e
It works fine in pre 3.2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked RunKit reproduction and inspect the behavior around td.replace and td.when when used with the shown generator method. Compare it with the stated pre-3.2 behavior; done means Service.send() can be replaced and then resolved through td.when without breaking.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.