Add integration test for Board component

This commit is contained in:
riggraz
2019-09-03 18:37:27 +02:00
parent 88096b2262
commit 4a1378988a
5 changed files with 151 additions and 6 deletions

View File

@@ -85,7 +85,7 @@ class NewPost extends React.Component<Props, State> {
}
try {
let res = await fetch('http://localhost:3000/posts', {
let res = await fetch('/posts', {
method: 'POST',
headers: {
Accept: 'application/json',
@@ -139,7 +139,7 @@ class NewPost extends React.Component<Props, State> {
{ showForm ? 'Cancel' : 'Submit feedback' }
</button>
:
<a href="http://localhost:3000/users/sign_in" className="btn btn-dark">
<a href="/users/sign_in" className="btn btn-dark">
Log in / Sign up
</a>
}

View File

@@ -16,7 +16,7 @@ const PostStatusListItem = ({
isCurrentFilter,
handleResetFilter,
}: Props) => (
<div className="postStatusListItemContainer">
<div className={"postStatusListItemContainer " + `postStatus${name.replace(/ /g, '')}`}>
<a onClick={handleClick} className="postStatusListItemLink">
<div className="postStatusListItem">
<div className="dot" style={{backgroundColor: color}}></div>

View File

@@ -74,7 +74,7 @@ class Board extends React.Component<Props, State> {
if (byPostStatus) params += `&post_status_id=${byPostStatus}`;
try {
let res = await fetch(`http://localhost:3000/posts?board_id=${boardId}${params}`);
let res = await fetch(`/posts?board_id=${boardId}${params}`);
let data = await res.json();
this.setState({
@@ -110,7 +110,7 @@ class Board extends React.Component<Props, State> {
});
try {
let res = await fetch('http://localhost:3000/post_statuses');
let res = await fetch('/post_statuses');
let data = await res.json();
this.setState({