我是Jamine测试框架的新手,目前我有模拟界面的问题。有人可以帮助我吗?
界面如下:
interface MessengerSubscribe {
onSystemLoggedIn(callback: (data: INotLoggedinInfo) => void): MessengerSubscription;
onSessionTimedOut(callback: () => void): MessengerSubscription;
onHasEssBalance(callback: () => void): MessengerSubscription;
}
这是我尝试过的不起作用。
let mockMessenger: MessengerStatic = {
subscribe: {
onSystemLoggedIn: () => <MessengerSubscription>
}
};
这是消息说明:
interface MessengerSubscription {
dispose(): void;
}
答案 0 :(得分:0)
一个简单的模拟看起来像:
let mockMessenger: MessengerSubscribe = {
onSystemLoggedIn: (callback: any): any => {},
onSessionTimedOut: (callback: any): any => {},
onHasEssBalance: (callback: any): any => {}
};