Skip to content

Commit

Permalink
fix mock snippets and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
equiman committed Apr 3, 2023
1 parent a9f85f5 commit f699fa1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ Fixed for any bug fixes.
Security to invite users to upgrade in case of vulnerabilities.
-->

## 1.4.1 - 2023/04/03

### Fixed

- mock name snippets
- import documentation

## 1.4.0 - 2023/03/31

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Below is a list of all available snippets and the triggers of each one. The `░
| Trigger | Result |
| -------: | ----------------------------------------------------------------- |
| `iv→` | `import { it, expect, describe } from 'vitest'█` |
| `itl→` | `import { render, screen } from '@testing-library/$<react|vue>█` |
| `itl→` | `import { render, screen } from '@testing-library/<react\|vue>█` |
| `itr→` | `import { render, screen } from '@testing-library/react█` |
| `itv→` | `import { render, screen } from '@testing-library/vue█` |

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vitest-snippets",
"description": "VS Code Vitest snippets for JS and TS",
"version": "1.4.0",
"version": "1.4.1",
"displayName": "Vitest Snippets",
"publisher": "deinsoftware",
"icon": "images/light-icon.png",
Expand Down
16 changes: 8 additions & 8 deletions snippets/mock.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,42 @@
},
"const.fn": {
"prefix": "cf",
"body": "const {$1:name}Mock = vi.fn()$0",
"body": "const ${1:name}Mock = vi.fn()$0",
"description": "creates a mock variable for a vi.fn()"
},
"const.fn.mockResolvedValue": {
"prefix": "cfrv",
"body": "const {$1:name}Mock = vi.fn().mockResolvedValue($0)",
"body": "const ${1:name}Mock = vi.fn().mockResolvedValue($0)",
"description": "creates a mock variable for a vi.fn() with resolved value"
},
"mock.mockReturnValue": {
"prefix": "mrv",
"body": "{$1:mock}.mockReturnValue($0)",
"body": "${1:mock}.mockReturnValue($0)",
"description": "assign a return value"
},
"mock.mockReturnValueOnce": {
"prefix": "mrvo",
"body": "{$1:mock}.mockReturnValueOnce($0)",
"body": "${1:mock}.mockReturnValueOnce($0)",
"description": "assign a return value for only one call"
},
"vi.spyOn": {
"prefix": "vs",
"body": "vi.spyOn({$1:global}, '{$2:method}'))$0",
"body": "vi.spyOn(${1:global}, '${2:method}'))$0",
"description": "creates vi.spyOn()"
},
"vi.spyOn.mockImplementation": {
"prefix": "vsi",
"body": "vi.spyOn({$1:global}, '{$2:method}')).mockImplementation(() => $0)",
"body": "vi.spyOn(${1:global}, '${2:method}')).mockImplementation(() => $0)",
"description": "creates vi.spyOn() with mock implementation"
},
"const.spyOn": {
"prefix": "cs",
"body": "const {$2:method}Spy = vi.spyOn({$1:global}, '{$2:method}'))$0",
"body": "const ${2:method}Spy = vi.spyOn(${1:global}, '${2:method}'))$0",
"description": "creates a spy variable for a vi.spyOn()"
},
"const.spyOn.mockImplementation": {
"prefix": "csi",
"body": "const {$2:method}Spy = vi.spyOn({$1:global}, '{$2:method}')).mockImplementation(() => $0)",
"body": "const ${2:method}Spy = vi.spyOn(${1:global}, '${2:method}')).mockImplementation(() => $0)",
"description": "creates a spy variable for a vi.spyOn() with mock implementation"
}
}

0 comments on commit f699fa1

Please sign in to comment.