Skip to content

Commit

Permalink
fix: add missing method types for moduleContainer (#120)
Browse files Browse the repository at this point in the history
* docs: include "addModule" option

fixes #119

* fix(assertions): include "addModule"

* docs: add missing options

* fix(assertions): missing option types
  • Loading branch information
achimoraites authored May 10, 2021
1 parent e3ad52e commit 642e1d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/content/en/api-reference/module-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ When you write tests for a Nuxt module, you normally expect the module to be ins
* `method`
* Type: `String`
* `required`
* Available values are `addPlugin`, `addLayout`, `addErrorLayout`, `addServerMiddleware` and `requireModule`
* Available values are `addTemplate`, `extendBuild`, `extendRoutes`, `addModule`, `addPlugin`, `addLayout`, `addErrorLayout`, `addServerMiddleware` and `requireModule`
* `args`
* `optional`
* Additional parameters that are expected to be passed to the tested `method`
Expand All @@ -38,7 +38,7 @@ test('should inject plugin', () => {
* `method`
* Type: `String`
* `required`
* Available values are `addPlugin`, `addLayout`, `addErrorLayout`, `addServerMiddleware` and `requireModule`
* Available values are `addTemplate`, `extendBuild`, `extendRoutes`, `addModule`, `addPlugin`, `addLayout`, `addErrorLayout`, `addServerMiddleware` and `requireModule`
* `args`
* `optional`
* Additional parameters that are expected to be passed to the tested `method`
Expand Down
2 changes: 1 addition & 1 deletion src/assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { existsSync } from 'fs'
import { resolve } from 'path'
import { getNuxt } from './nuxt'

type ModuleContainerMethod = 'addPlugin' | 'addLayout' | 'addErrorLayout' | 'addServerMiddleware' | 'requireModule'
type ModuleContainerMethod = 'addTemplate' | 'extendBuild' | 'extendRoutes' | 'addModule' | 'addPlugin' | 'addLayout' | 'addErrorLayout' | 'addServerMiddleware' | 'requireModule'

export function expectModuleToBeCalledWith (method: ModuleContainerMethod, ...args: any[]) {
expect(getNuxt().moduleContainer[method]).toBeCalledWith(...args)
Expand Down

0 comments on commit 642e1d7

Please sign in to comment.