我的标准免责声明:我在大约10年内没有使用Java,所以我很可能在这里做了一些基本错误.
我正在为SmartFoxServer(SFS)编写一个"服务器端扩展" .在我的登录脚本中,我需要连接到MS SQL Server,我正在尝试使用JDBC.我在调试环境中测试了JDBC代码,它工作正常.
但
当我将服务器端扩展放在SFS"extensions"文件夹中时(根据规范),我得到一个com.microsoft.sqlserver.jdbc.SQLServerException:
"此驱动程序未配置为集成身份验证."
我用Google搜索了这个错误,发现它通常是因为文件sqljdbc_auth.dll不在系统路径中; 我已将此文件复制到系统路径中的文件夹中,但仍然无效!
还有其他建议吗?
我是 Jest 和 Enzyme 测试的新手,我想知道为什么 find 函数不适用于 id。
//来自react的html,只是id增量所在的代码
<div className="App-body">
<div className="changePage">
<button className="Selections" onClick={this.decrementPage}>Previous</button>
<p className="changePageNumber">{this.state.page}</p>
<button className="Selections" id="increment" onClick={this.incrementPage}>Next</button>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
//测试
it('next page', () => {
const wrapper = shallow(<Home />)
const incrementPage = wrapper.find('#increment')
incrementPage.simulate('click')
const countState = wrapper.state().page
expect(countState).toEqual(2)
})Run Code Online (Sandbox Code Playgroud)
Method “simulate” is meant to be run on 1 node. 0 found instead.
Run Code Online (Sandbox Code Playgroud)
Method “simulate” is meant to be run on 1 node. 0 found instead.
Run Code Online (Sandbox Code Playgroud)
我正在尝试将 MP4 视频添加到我的媒体库中。它没有给出任何错误,但是当我尝试播放视频时,它会在视频播放器中显示以下消息:
媒体错误:不支持格式或找不到源
视频大小为2MB。
使用 jest 运行测试时,我有基本的测试服语法:
jest.mock('axios');
describe('app', () => {
let render
beforeEach(() => {
axiosMock.get.mockResolvedValueOnce({
data: {greeting: 'hello there'},
}),
render= renderApp()
});
test('should render something', () => {
expect(something).toBeInTheDocument();
});
});
Run Code Online (Sandbox Code Playgroud)
问题是我的代码中有拦截器,当使用 jest 命令输出运行测试时:
类型错误:无法读取未定义的属性“拦截器”
并指向拦截器对象
axiosInstance.interceptors.request.use(...
axiosInstance 是存储返回的变量 axios.create
export const axiosInstance = axios.create({...
在 SO How do I test axios in jest上参考了这个 axios 线程,但它不涉及任何拦截器,所以并没有真正的帮助。
我正在使用 angular 6 和 ngx-bootstrap 3.0.1
我显示一个模态,当用户在更新表单后尝试关闭模态时,我希望能够显示丢弃/取消确认。
当用户使用我的自定义关闭按钮时我没有问题,但是当他在模式外使用背景单击时我不知道如何调用我的关闭函数。
如何干净地处理背景点击以显示我的确认消息?
我似乎只能找到有关列表中最后一个/第一个元素的答案,或者您可以获得特定项目等。
假设我有一个包含 100 个元素的列表,我想返回最后 40 个元素。我怎么做?我尝试这样做,但它给了我一个元素..
Post last40posts = posts.get(posts.size() -40);
Run Code Online (Sandbox Code Playgroud) 在JUnit 4中,“超时”注释参数可用于强制测试在给定的时间后停止:
@Test(timeout=100)
public void infinity() {
while(true);
}
Run Code Online (Sandbox Code Playgroud)
如何在JUnit 5中完成?