-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: Command signature changed The merge context mechanism does not work anymore
- Loading branch information
Showing
5 changed files
with
19 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import { unpartial } from 'unpartial' | ||
import { Command, CommandConstructor, CommandContext } from './Command' | ||
import { Command } from './Command' | ||
import { Emitter } from './Emitter' | ||
import { TestEmitter } from './TestEmitter' | ||
|
||
export function setupCommandTest<Context extends CommandContext, Cmd extends Command>(Command: CommandConstructor<Context, Cmd>, givenContext: Partial<Context> = {}) { | ||
export function setupCommandTest<Cmd extends Command, Args extends any[]>(Command: new (emitter: Emitter, ...args: Args) => Cmd, ...args: Args) { | ||
const emitter = new TestEmitter() | ||
const context = unpartial<Context>({ emitter } as any, givenContext) | ||
const command = new Command(context) | ||
const command = new Command(emitter, ...args) | ||
return { emitter, command } | ||
} |