Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(sandbox): fix example that defines a non-function property #2543

Merged
merged 1 commit into from
Sep 11, 2023
Merged

docs(sandbox): fix example that defines a non-function property #2543

merged 1 commit into from
Sep 11, 2023

Conversation

MrChocolatine
Copy link
Contributor

@MrChocolatine MrChocolatine commented Sep 11, 2023

Purpose (TL;DR)

This PR follows #2539 and fixes the example that defines a non-function property when using .define().

Solution

This fixes works by following the tests of .define():

sinon/test/sandbox-test.js

Lines 819 to 833 in baa1aee

it("should define a function property", function () {
function newFunction() {
return;
}
const object = {};
this.sandbox.define(object, "property", newFunction);
assert.equals(object.property, newFunction);
this.sandbox.restore();
assert.isUndefined(object.property);
});

How to verify

  1. Check out this branch
  2. npm install
  3. npm test

Checklist for author

  • npm run lint passes
  • References to standard library functions are cached.

@codecov
Copy link

codecov bot commented Sep 11, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (baa1aee) 95.95% compared to head (83ce3a9) 95.95%.

❗ Current head 83ce3a9 differs from pull request most recent head 53320b1. Consider uploading reports for the commit 53320b1 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2543   +/-   ##
=======================================
  Coverage   95.95%   95.95%           
=======================================
  Files          40       40           
  Lines        1904     1904           
=======================================
  Hits         1827     1827           
  Misses         77       77           
Flag Coverage Δ
unit 95.95% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fatso83 fatso83 merged commit 67a8cea into sinonjs:main Sep 11, 2023
8 checks passed
@fatso83
Copy link
Contributor

fatso83 commented Sep 11, 2023

Thanks!

@MrChocolatine MrChocolatine deleted the patch-1 branch September 11, 2023 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants