我正在构建一个使用 React-query 来获取数据的 NextJS 应用程序。
我现在正在尝试实现一个测试框架。但是,当我运行时yarn test,出现以下错误。从react-query文档中,我了解到错误通常与<QueryClientProvider>未包含在_app.js.
我怀疑我需要为反应查询引入一些“模拟数据”,index.test.js但无法找到有关如何执行此操作的文档。
No QueryClient set, use QueryClientProvider to set one
Run Code Online (Sandbox Code Playgroud)
/测试/index.test.js
No QueryClient set, use QueryClientProvider to set one
Run Code Online (Sandbox Code Playgroud)
/pages/index.js
import { render, screen } from '@testing-library/react';
import Home from '../pages/index';
describe('Home', () => {
it('renders without crashing', () => {
render(<Home />);
expect(
screen.getByRole('heading', { name: 'Welcome to Next.js!' })
).toBeInTheDocument();
});
});
Run Code Online (Sandbox Code Playgroud)
/pages/_app.js
import Link from 'next/link';
import { …Run Code Online (Sandbox Code Playgroud) 我正在尝试更新SQL。
我怀疑问题出在我的SQL查询中,还是我的连接中。虽然,我可能完全错了。
抱歉,如果是凌乱的,但是我正在console.log尝试调试该问题,控制台输出为:
B.1
B.2
D.1
D.2
D.3
B.2.1
B.5
Run Code Online (Sandbox Code Playgroud)
关于sql查询,除其他外,我尝试了以下两个:
$sql = "UPDATE Users SET description = " . '$description' . "WHERE userID = " . '$this->userID';$sql = "UPDATE Users SET description = '$description' WHERE userID = '$this->userID'";编辑配置文件处理程序.php
<?php
if(isset($_POST['edit-profile-button'])) {
$description = $_POST['edit-description'];
echo '<script>console.log("B.1")</script>';
if(isset($description)) {
echo '<script>console.log("B.2")</script>';
$result = $user->updateDescription($description);
echo '<script>console.log("B.2.1")</script>';
}
if($result == true) {
echo '<script>console.log("B.4")</script>';
header("Location: profile.php");
}
echo '<script>console.log("B.5")</script>';
}
?> …Run Code Online (Sandbox Code Playgroud) 我正在尝试安装pyproj,但出现Proj executable not found. Please set PROJ_DIR variable错误。
$ pipenv install pyproj
我也尝试pipenv git+https://github.com/jswhit/pyproj.git#egg=pyproj过同样的结果。
$ pipenv install pyproj
Installation Succeeded
Locking [dev-packages] dependencies
Locking ['packages] dependancies
Success!
Installing dependencies from Pipfile.lock
[pipenv.exceptions.InstallError]: ['Collecting pyproj==2.0.0 (from -r /var/folders/g3/912
vtylj2hb71xf_d_8sxz480000gn/T/pipenv-qeun2uwi-requirements/pipenv-behbdii2-requirement.tx
t (line 1))', ' Using cached https://files.pythonhosted.org/packages/53/4b/21643a93e7d33
941498087290636e34c6d534aa8baa1ada54cf0d096ffaa/pyproj-2.0.0.tar.gz', ' Installing build
dependencies: started', " Installing build dependencies: finished with status 'done'",
' Getting requirements to build wheel: started', " Getting requirements to build …