oauth - 用 Jest 测试 OAuth
问题描述
我是开玩笑的新手。我创建了一个包装 Microsoft 身份验证库 (MSAL.js) 的 Vue 插件。我想用 Jest 对它进行单元测试。基本测试已启动并运行(是挂载在 Vue 实例上的插件方法等)。
我想测试对身份验证服务的实际调用。我遇到了没有浏览器的问题。
错误:未实现:window.open
这是我的测试代码。
it('should fail with a useful error when configuration or option settings are not set or are incorrect', () => {
const azureAuthService = new AzureAuthService()
const testException = () => {
azureAuthService.login()
}
expect(testException).toThrow(TypeError)
})
有关如何实施此测试的任何建议
解决方案
推荐阅读
- python - 无损修剪和裁剪 MJPEG 视频
- r - 从“plm”包中为“pcce”模型扩展“texreg”时出错
- javascript - 错误:无法解析模块 ./navRoutes
- python - 如何将字符串分开两次?
- swift - 关于如何摆脱 Main.storyboard 中的 Xcode 导航栏的简单问题?
- laravel - 在 laravel 中,我可以在控制器中使用访问器还是有更好的方法来做我想做的事情?
- reactjs - 如何在 React 中为路由实现“render-as-you-fetch”模式
- r - 由于重新排序,缩放 x 轴不起作用?
- android-studio - Android Emulator 关闭,因为 emuglConfig_init: blacklisted=0 , GPI emulation enabled using 'swiftshader_indirect' mode
- javascript - 如何使用 react-native-render-html 从 Raw HTML 转换数据并将其自定义为 React Native 中的省略号