scriptable-testlab
Version:
A lightweight, efficient tool designed to manage and update scripts for Scriptable.
41 lines (32 loc) • 846 B
text/typescript
import {AbsScript} from 'scriptable-abstract';
export interface ScriptMockState {
name: string;
shortcutOutput?: any;
widget?: any;
}
const DEFAULT_STATE: ScriptMockState = {
name: '',
};
export class MockScript extends AbsScript<ScriptMockState> {
static get instance(): MockScript {
return super.instance as MockScript;
}
constructor() {
super(DEFAULT_STATE);
}
name(): string {
return this.state.name;
}
complete(): void {
// This method is called when the script execution is complete
// In a mock environment, we don't need to do anything specific
}
setShortcutOutput(value: any): void {
// Store the shortcut output in state
this.setState({shortcutOutput: value});
}
setWidget(widget: any): void {
// Store the widget in state
this.setState({widget: widget});
}
}