pokerogue/test/test-utils/text-interceptor.ts
Sirz Benjie 51d4c33de0
[Misc] Standardize-file-names (#6137)
* Standardize filenames to kebab-case

Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com>

* Move script outside of public folder

* Move update_exp_sprites to scripts

* Add ls-lint to lint file and directory names

* Update lefthook.yml to skip merge / rebase on all pre-commit commands

---------

Co-authored-by: pymilkmaiden <cassiopeiamahler56@gmail.com>
2025-07-24 16:38:31 -04:00

40 lines
787 B
TypeScript

/**
* Class will intercept any text or dialogue message calls and log them for test purposes
*/
export class TextInterceptor {
private scene;
public logs: string[] = [];
constructor(scene) {
this.scene = scene;
scene.messageWrapper = this;
}
showText(
text: string,
_delay?: number,
_callback?: Function,
_callbackDelay?: number,
_prompt?: boolean,
_promptDelay?: number,
): void {
console.log(text);
this.logs.push(text);
}
showDialogue(
text: string,
name: string,
_delay?: number,
_callback?: Function,
_callbackDelay?: number,
_promptDelay?: number,
): void {
console.log(name, text);
this.logs.push(name, text);
}
getLatestMessage(): string {
return this.logs.pop() ?? "";
}
}