Skip to content

Commit

Permalink
docs: the new operator support has been documented
Browse files Browse the repository at this point in the history
  • Loading branch information
dvabuzyarov committed Dec 21, 2020
1 parent a80f351 commit a2e3b9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,10 @@ mock.verify(instance => "method" in instance, Times.Once());
The library supports [new operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new).
More examples could be found [here](https://raw.githubusercontent.com/dvabuzyarov/moq.ts/master/projects/moq/src/integration.specs/new-operator.spec.ts)

> [In order for the new operation to be valid on the resulting Proxy object,
> the target used to initialize the proxy must itself have a [[Construct]] internal method
> (i.e. new target must be valid)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/construct).
```typescript
class TestObject {
constructor(public readonly arg) {
Expand Down Expand Up @@ -608,4 +612,4 @@ expect(MoqAPI in object).toBe(true);
expect(object[MoqAPI]).toBe(mock);
```

Sponsored by [2BIT](https://www.2bit.ch)
> [Sponsored by 2BIT GmbH](https://www.2bit.ch)

0 comments on commit a2e3b9b

Please sign in to comment.