Skip to content
This repository was archived by the owner on Apr 18, 2022. It is now read-only.

Commit 33730d7

Browse files
committed
Update version
1 parent a99e6d5 commit 33730d7

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

README.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Mock
22

3-
[![version](https://img.shields.io/badge/release-v0.6.0-success)](https://github.com/udibo/mock/tree/v0.6.0)
4-
[![deno doc](https://img.shields.io/badge/deno-doc-success?logo=deno)](https://doc.deno.land/https/deno.land/x/[email protected].0/mod.ts)
3+
[![version](https://img.shields.io/badge/release-v0.6.1-success)](https://github.com/udibo/mock/tree/v0.6.1)
4+
[![deno doc](https://img.shields.io/badge/deno-doc-success?logo=deno)](https://doc.deno.land/https/deno.land/x/[email protected].1/mod.ts)
55
[![deno version](https://img.shields.io/badge/deno-v1.4.0-success?logo=deno)](https://github.com/denoland/deno/tree/v1.4.0)
66
[![CI](https://github.com/udibo/mock/workflows/CI/badge.svg)](https://github.com/udibo/mock/actions?query=workflow%3ACI)
77
[![license](https://img.shields.io/github/license/udibo/mock)](https://github.com/udibo/mock/blob/master/LICENSE)
@@ -26,18 +26,18 @@ but can also be imported directly from GitHub using raw content URLs.
2626

2727
```ts
2828
// Import from Deno's third party module registry
29-
import { spy, Spy } from "https://deno.land/x/[email protected].0/mod.ts";
29+
import { spy, Spy } from "https://deno.land/x/[email protected].1/mod.ts";
3030
// Import from GitHub
31-
import { spy, Spy } "https://raw.githubusercontent.com/udibo/mock/v0.6.0/mod.ts";
31+
import { spy, Spy } "https://raw.githubusercontent.com/udibo/mock/v0.6.1/mod.ts";
3232
```
3333
3434
If you do not need all of the sub-modules, you can choose to just import the sub-modules you need.
3535
3636
```ts
3737
// Import from Deno's third party module registry
38-
import { spy, Spy } from "https://deno.land/x/[email protected].0/spy.ts";
38+
import { spy, Spy } from "https://deno.land/x/[email protected].1/spy.ts";
3939
// Import from GitHub
40-
import { spy, Spy } from "https://raw.githubusercontent.com/udibo/mock/v0.6.0/spy.ts";
40+
import { spy, Spy } from "https://raw.githubusercontent.com/udibo/mock/v0.6.1/spy.ts";
4141
```
4242

4343
#### Sub-modules
@@ -57,14 +57,14 @@ Node.js fully supports ES Modules.
5757
If a Node.js package has the type "module" specified in its package.json file, the JavaScript bundle can be imported as a `.js` file.
5858

5959
```js
60-
import { spy, Spy } from "./mock_v0.6.0.js";
60+
import { spy, Spy } from "./mock_v0.6.1.js";
6161
```
6262

6363
The default type for Node.js packages is "commonjs".
6464
To import the bundle into a commonjs package, the file extension of the JavaScript bundle must be changed from `.js` to `.mjs`.
6565

6666
```js
67-
import { spy, Spy } from "./mock_v0.6.0.mjs";
67+
import { spy, Spy } from "./mock_v0.6.1.mjs";
6868
```
6969

7070
See [Node.js Documentation](https://nodejs.org/api/esm.html) for more information.
@@ -82,15 +82,15 @@ Script tags for ES modules must have the type attribute set to "module".
8282

8383
```js
8484
// main.js
85-
import { spy, Spy } from "./mock_v0.6.0.js";
85+
import { spy, Spy } from "./mock_v0.6.1.js";
8686
```
8787

8888
You can also embed a module script directly into an HTML file by placing the JavaScript code
8989
within the body of the script tag.
9090

9191
```html
9292
<script type="module">
93-
import { spy, Spy } from "./mock_v0.6.0.js";
93+
import { spy, Spy } from "./mock_v0.6.1.js";
9494
</script>
9595
```
9696

@@ -100,7 +100,7 @@ See [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/
100100

101101
Below are some examples of how to use Spys, Stubs, and FakeTime in tests. When spying/stubing instance methods, you should wrap the calls and expectations with a try block then restore the function in a finally block to ensure the original instance method is restored before continuing to other tests. The same applies when using fake time.
102102

103-
See [deno docs](https://doc.deno.land/https/deno.land/x/[email protected].0/mod.ts) for more information.
103+
See [deno docs](https://doc.deno.land/https/deno.land/x/[email protected].1/mod.ts) for more information.
104104

105105
### Spy
106106

@@ -109,8 +109,8 @@ When spying on a function or instance method, all arguments and return values ar
109109
If you have a function that takes a callback but you don't need it to do anything, you can create an empty spy. An empty spy will just return undefined for any calls made to it.
110110

111111
```ts
112-
import { assertEquals } from "https://deno.land/std@0.67.0/testing/asserts.ts";
113-
import { spy, Spy } from "https://deno.land/x/[email protected].0/spy.ts";
112+
import { assertEquals } from "https://deno.land/std@0.69.0/testing/asserts.ts";
113+
import { spy, Spy } from "https://deno.land/x/[email protected].1/spy.ts";
114114

115115
function add(
116116
a: number,
@@ -137,8 +137,8 @@ Deno.test("calls fake callback", () => {
137137
If you have a function that takes a callback that needs to still behave normally, you can wrap it with a spy.
138138

139139
```ts
140-
import { assertEquals } from "https://deno.land/std@0.67.0/testing/asserts.ts";
141-
import { spy, Spy } from "https://deno.land/x/[email protected].0/spy.ts";
140+
import { assertEquals } from "https://deno.land/std@0.69.0/testing/asserts.ts";
141+
import { spy, Spy } from "https://deno.land/x/[email protected].1/spy.ts";
142142

143143
function filter<T>(values: T[], callback: (value: T) => boolean): any[] {
144144
return values.filter(callback);
@@ -165,8 +165,8 @@ Deno.test("calls real callback", () => {
165165
If you have an instance method that needs to still behave normally, you can wrap it with a spy. When you are done spying on a method, you need to call the restore function on the spy object to remove the wrapper from the instance method. If it is not restored and you attempt to wrap it again, it will throw a spy error saying "already spying on function".
166166

167167
```ts
168-
import { assertEquals } from "https://deno.land/std@0.67.0/testing/asserts.ts";
169-
import { spy, Spy } from "https://deno.land/x/[email protected].0/spy.ts";
168+
import { assertEquals } from "https://deno.land/std@0.69.0/testing/asserts.ts";
169+
import { spy, Spy } from "https://deno.land/x/[email protected].1/spy.ts";
170170

171171
class Database {
172172
private queries: any;
@@ -249,8 +249,8 @@ When stubbing an instance method, all arguments and return values are recorded b
249249
If you have an instance method but you don't need it to do or return anything, you can create an empty stub. An empty stub will just return undefined for any calls made to it. If you need it to return specific values instead, you can add return values after initialization by replacing or adding to the `stub.returns` queue. When the returns queue is empty, it will return undefined.
250250

251251
```ts
252-
import { assertEquals } from "https://deno.land/std@0.67.0/testing/asserts.ts";
253-
import { stub, Stub } from "https://deno.land/x/[email protected].0/stub.ts";
252+
import { assertEquals } from "https://deno.land/std@0.69.0/testing/asserts.ts";
253+
import { stub, Stub } from "https://deno.land/x/[email protected].1/stub.ts";
254254

255255
class Cat {
256256
action(name: string): any {
@@ -283,8 +283,8 @@ Deno.test("doAction", () => {
283283
If you have an instance method but need it to return specific values for each call, you can create a stub with an array of values in the order that you want them returned. You can add more return values after initialization by replacing or adding to the `stub.returns` queue.
284284

285285
```ts
286-
import { assertEquals } from "https://deno.land/std@0.67.0/testing/asserts.ts";
287-
import { stub, Stub } from "https://deno.land/x/[email protected].0/stub.ts";
286+
import { assertEquals } from "https://deno.land/std@0.69.0/testing/asserts.ts";
287+
import { stub, Stub } from "https://deno.land/x/[email protected].1/stub.ts";
288288

289289
class Database {
290290
query(query: string, params: any[]): any[][] {
@@ -355,8 +355,8 @@ Deno.test("getUsers", () => {
355355
If you have an instance method but need it to call a replacement function instead of the original, you can create a stub with a replacement function. If you need it to return specific values instead, you can add return values after initialization by replacing or adding to the `stub.returns` queue. When the returns queue is empty, it will call the replacement function.
356356

357357
```ts
358-
import { assertEquals } from "https://deno.land/std@0.67.0/testing/asserts.ts";
359-
import { stub, Stub } from "https://deno.land/x/[email protected].0/stub.ts";
358+
import { assertEquals } from "https://deno.land/std@0.69.0/testing/asserts.ts";
359+
import { stub, Stub } from "https://deno.land/x/[email protected].1/stub.ts";
360360

361361
class Database {
362362
query(query: string, params: any[]): any[][] {
@@ -431,9 +431,9 @@ Overrides the real Date object and timer functions with fake ones that can be
431431
controlled through the fake time instance.
432432

433433
```ts
434-
import { assertEquals } from "https://deno.land/std@0.67.0/testing/asserts.ts";
435-
import { spy, Spy } from "https://deno.land/x/[email protected].0/spy.ts";
436-
import { FakeTime } from "https://deno.land/x/[email protected].0/time.ts";
434+
import { assertEquals } from "https://deno.land/std@0.69.0/testing/asserts.ts";
435+
import { spy, Spy } from "https://deno.land/x/[email protected].1/spy.ts";
436+
import { FakeTime } from "https://deno.land/x/[email protected].1/time.ts";
437437

438438
function secondInterval(cb: () => void): void {
439439
setInterval(cb, 1000);

0 commit comments

Comments
 (0)