From d880aed87fe107e974c50485357a7f8a9453ea52 Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Mon, 27 May 2024 14:32:11 +0200 Subject: [PATCH 01/14] add delete functionality --- src/Components/Notes/NoteCard.jsx | 5 +++++ src/Components/Notes/NoteFooter.jsx | 31 ++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/Components/Notes/NoteCard.jsx b/src/Components/Notes/NoteCard.jsx index 2b2dcc79b..aee4e5049 100644 --- a/src/Components/Notes/NoteCard.jsx +++ b/src/Components/Notes/NoteCard.jsx @@ -9,6 +9,10 @@ import { updateIssue, // TODO(pablo): deleteComment as deleteCommentGitHub, } from '../../net/github/Issues' +import { + deleteComment, + // TODO(pablo): deleteComment as deleteCommentGitHub, +} from '../../net/github/Comments' import useStore from '../../store/useStore' import {assertDefined} from '../../utils/assert' import {getHashParamsFromHashStr, setHashParams} from '../../utils/location' @@ -227,6 +231,7 @@ export default function NoteCard({ selectCard={selectCard} selected={selected} submitUpdate={submitUpdate} + deleteComment={deleteComment} synched={synched} username={username} /> diff --git a/src/Components/Notes/NoteFooter.jsx b/src/Components/Notes/NoteFooter.jsx index 257d11c55..3a1e6a455 100644 --- a/src/Components/Notes/NoteFooter.jsx +++ b/src/Components/Notes/NoteFooter.jsx @@ -11,6 +11,7 @@ import AddCommentOutlinedIcon from '@mui/icons-material/AddCommentOutlined' import CheckIcon from '@mui/icons-material/Check' import ForumOutlinedIcon from '@mui/icons-material/ForumOutlined' import GitHubIcon from '@mui/icons-material/GitHub' +import DeleteIcon from '@mui/icons-material/Delete' import PhotoCameraIcon from '@mui/icons-material/PhotoCamera' import CameraIcon from '../../assets/icons/Camera.svg' import PlaceMarkIcon from '../../assets/icons/PlaceMark.svg' @@ -23,6 +24,7 @@ import ShareIcon from '../../assets/icons/Share.svg' */ export default function NoteFooter({ accessToken, + deleteComment, editMode, embeddedCameras, id, @@ -138,15 +140,6 @@ export default function NoteFooter({ /> } - {editMode && - } - onClick={() => submitUpdate(repository, accessToken, id)} - /> - } - {isNote && !selected && } {!selected && numberOfComments} + {editMode && + } + onClick={() => submitUpdate(repository, accessToken, id)} + /> + } } + {!isNote && + + <> + } + onClick={() => deleteComment(repository, accessToken, id)} + /> + + + } ) } From cba657b3fca7a7ac67b395c11e096a1964234bed Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Mon, 27 May 2024 19:29:04 +0200 Subject: [PATCH 02/14] sort out the comment id issue --- src/Components/Notes/NoteFooter.jsx | 7 ++++++- src/__mocks__/api-handlers.js | 2 +- src/net/github/Comments.test.js | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Components/Notes/NoteFooter.jsx b/src/Components/Notes/NoteFooter.jsx index 3a1e6a455..cc9d7a85c 100644 --- a/src/Components/Notes/NoteFooter.jsx +++ b/src/Components/Notes/NoteFooter.jsx @@ -65,6 +65,11 @@ export default function NoteFooter({ '_blank') } + /** Delete issue comment */ + function closeComment() { + deleteComment(repository, id, accessToken ) + } + return ( {isNote && @@ -180,7 +185,7 @@ export default function NoteFooter({ title='Delete' placement='top' icon={} - onClick={() => deleteComment(repository, accessToken, id)} + onClick={closeComment} /> diff --git a/src/__mocks__/api-handlers.js b/src/__mocks__/api-handlers.js index e232c709a..42daa3c6e 100644 --- a/src/__mocks__/api-handlers.js +++ b/src/__mocks__/api-handlers.js @@ -235,7 +235,7 @@ function githubHandlers(githubStore) { rest.delete(`${GH_BASE}/repos/:org/:repo/issues/comments/:commentId`, (req, res, ctx) => { const {org, repo, commentId} = req.params - if (org !== 'bldrs-ai' || repo !== 'Share' || !commentId) { + if (org !== 'pablo-mayrgundter' || repo !== 'Share' || !commentId) { return res(ctx.status(httpNotFound)) } diff --git a/src/net/github/Comments.test.js b/src/net/github/Comments.test.js index 642ccf627..a3ad4f889 100644 --- a/src/net/github/Comments.test.js +++ b/src/net/github/Comments.test.js @@ -14,7 +14,7 @@ describe('net/github/Comments', () => { }) it('successfully delete comment', async () => { - const res = await deleteComment({orgName: 'bldrs-ai', name: 'Share'}, 1) + const res = await deleteComment({orgName: 'pablo-mayrgundter', name: 'Share'}, 1) expect(res.status).toEqual(httpOK) }) }) From 3d1d4e3eb7139492989ec32e748c7f2b5fd99657 Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Mon, 27 May 2024 19:36:48 +0200 Subject: [PATCH 03/14] add the console log for the comment user --- src/Components/Notes/Notes.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Components/Notes/Notes.jsx b/src/Components/Notes/Notes.jsx index a08f24204..23ea477ce 100644 --- a/src/Components/Notes/Notes.jsx +++ b/src/Components/Notes/Notes.jsx @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import React, {ReactElement, useEffect, useState} from 'react' import Box from '@mui/material/Box' import List from '@mui/material/List' @@ -29,11 +30,13 @@ export default function Notes() { const repository = useStore((state) => state.repository) const selectedNoteId = useStore((state) => state.selectedNoteId) const setComments = useStore((state) => state.setComments) + console.log('comments', comments) const [hasError, setHasError] = useState(false) const {user} = useAuth0() const isMobile = useIsMobile() + console.log('user', user) const selectedNote = (notes && selectedNoteId) ? From 80d8d0d520f1dd998908c9e741e184be0b757a43 Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Mon, 27 May 2024 20:08:12 +0200 Subject: [PATCH 04/14] add delete function --- src/Components/Notes/NoteCard.jsx | 22 +++++++--------------- src/Components/Notes/NoteFooter.jsx | 8 ++------ src/net/github/Comments.fixture.js | 4 ++-- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/Components/Notes/NoteCard.jsx b/src/Components/Notes/NoteCard.jsx index aee4e5049..1e1033621 100644 --- a/src/Components/Notes/NoteCard.jsx +++ b/src/Components/Notes/NoteCard.jsx @@ -7,11 +7,9 @@ import {useAuth0} from '../../Auth0/Auth0Proxy' import { closeIssue, updateIssue, - // TODO(pablo): deleteComment as deleteCommentGitHub, } from '../../net/github/Issues' import { deleteComment, - // TODO(pablo): deleteComment as deleteCommentGitHub, } from '../../net/github/Comments' import useStore from '../../store/useStore' import {assertDefined} from '../../utils/assert' @@ -65,9 +63,8 @@ export default function NoteCard({ const notes = useStore((state) => state.notes) const repository = useStore((state) => state.repository) const selectedNoteId = useStore((state) => state.selectedNoteId) - // TODO(pablo) - // const comments = useStore((state) => state.comments) - // const setComments = useStore((state) => state.setComments) + const comments = useStore((state) => state.comments) + const setComments = useStore((state) => state.setComments) const setNotes = useStore((state) => state.setNotes) const setSelectedNoteId = useStore((state) => state.setSelectedNoteId) const setSelectedNoteIndex = useStore((state) => state.setSelectedNoteIndex) @@ -162,16 +159,11 @@ export default function NoteCard({ * @param {string} accessToken * @param {number} commentId */ - // TODO(pablo) - /* async function deleteComment(commentId) { - // TODO(pablo): handle response - await deleteCommentGitHub(repository, commentId, accessToken) - const newComments = comments.map((comment) => ({ - ...comment, - synched: (comment.id !== commentId) && comment.synched, - })) + async function deleteCommentGithub(commentId) { + await deleteComment(repository, commentId, accessToken) + const newComments = comments.filter((comment) => comment.id !== commentId) setComments(newComments) - } */ + } /** Update issue on GH, set read-only */ @@ -231,7 +223,7 @@ export default function NoteCard({ selectCard={selectCard} selected={selected} submitUpdate={submitUpdate} - deleteComment={deleteComment} + deleteComment={deleteCommentGithub} synched={synched} username={username} /> diff --git a/src/Components/Notes/NoteFooter.jsx b/src/Components/Notes/NoteFooter.jsx index cc9d7a85c..113ba5a65 100644 --- a/src/Components/Notes/NoteFooter.jsx +++ b/src/Components/Notes/NoteFooter.jsx @@ -65,10 +65,6 @@ export default function NoteFooter({ '_blank') } - /** Delete issue comment */ - function closeComment() { - deleteComment(repository, id, accessToken ) - } return ( @@ -178,14 +174,14 @@ export default function NoteFooter({ } } - {!isNote && + {!isNote && user && username === user.nickname && <> } - onClick={closeComment} + onClick={() => deleteComment(id)} /> diff --git a/src/net/github/Comments.fixture.js b/src/net/github/Comments.fixture.js index 5efaa99c4..f8e15c142 100644 --- a/src/net/github/Comments.fixture.js +++ b/src/net/github/Comments.fixture.js @@ -11,7 +11,7 @@ export const MOCK_COMMENTS = { node_id: 'IC_kwDOFwgxOc5EPlQ3', number: 1, user: { - login: 'OlegMoshkovich', + login: 'cypresstester', id: 3433607, node_id: 'MDQ6VXNlcjM0MzM2MDY=', avatar_url: 'https://avatars.githubusercontent.com/u/3433606?v=4', @@ -56,7 +56,7 @@ export const MOCK_COMMENTS = { number: 2, node_id: 'IC_kwDOFwgxOc5EPlQ3', user: { - login: 'OlegMoshkovich', + login: 'cypresstester', id: 3433606, node_id: 'MDQ6VXNlcjM0MzM2MDY=', avatar_url: 'https://avatars.githubusercontent.com/u/3433606?v=4', From 31471e5fd528404419cdb7134198f673e5b71394 Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Mon, 27 May 2024 20:32:01 +0200 Subject: [PATCH 05/14] move the check in edit mode and disable test --- src/Components/Notes/NoteCard.test.jsx | 2 +- src/Components/Notes/NoteFooter.jsx | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Components/Notes/NoteCard.test.jsx b/src/Components/Notes/NoteCard.test.jsx index 417e1c46f..00ffed4c4 100644 --- a/src/Components/Notes/NoteCard.test.jsx +++ b/src/Components/Notes/NoteCard.test.jsx @@ -46,7 +46,7 @@ describe('NoteCard', () => { expect(screen.getByText(/bob/)).toBeInTheDocument() }) - it('Number of comments', () => { + it.skip('Number of comments', () => { const id = 123 const index = 123 const commentCount = 10 diff --git a/src/Components/Notes/NoteFooter.jsx b/src/Components/Notes/NoteFooter.jsx index 113ba5a65..889ed8f73 100644 --- a/src/Components/Notes/NoteFooter.jsx +++ b/src/Components/Notes/NoteFooter.jsx @@ -163,29 +163,28 @@ export default function NoteFooter({ icon={} /> } - {!selected && numberOfComments} - {editMode && - } - onClick={() => submitUpdate(repository, accessToken, id)} - /> - } } {!isNote && user && username === user.nickname && - <> } onClick={() => deleteComment(id)} /> - } + {editMode && + + } + onClick={() => submitUpdate(repository, accessToken, id)} + /> + + } ) } From 9ab9e6954924ce9bd5ded89ca311330d7258a47a Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Wed, 29 May 2024 11:17:48 +0200 Subject: [PATCH 06/14] resolve the issue with the comments --- src/Components/Notes/NoteCard.test.jsx | 2 +- src/Components/Notes/NoteFooter.jsx | 37 +++++++++++++------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Components/Notes/NoteCard.test.jsx b/src/Components/Notes/NoteCard.test.jsx index 00ffed4c4..417e1c46f 100644 --- a/src/Components/Notes/NoteCard.test.jsx +++ b/src/Components/Notes/NoteCard.test.jsx @@ -46,7 +46,7 @@ describe('NoteCard', () => { expect(screen.getByText(/bob/)).toBeInTheDocument() }) - it.skip('Number of comments', () => { + it('Number of comments', () => { const id = 123 const index = 123 const commentCount = 10 diff --git a/src/Components/Notes/NoteFooter.jsx b/src/Components/Notes/NoteFooter.jsx index 889ed8f73..427bf8716 100644 --- a/src/Components/Notes/NoteFooter.jsx +++ b/src/Components/Notes/NoteFooter.jsx @@ -11,7 +11,7 @@ import AddCommentOutlinedIcon from '@mui/icons-material/AddCommentOutlined' import CheckIcon from '@mui/icons-material/Check' import ForumOutlinedIcon from '@mui/icons-material/ForumOutlined' import GitHubIcon from '@mui/icons-material/GitHub' -import DeleteIcon from '@mui/icons-material/Delete' +import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline' import PhotoCameraIcon from '@mui/icons-material/PhotoCamera' import CameraIcon from '../../assets/icons/Camera.svg' import PlaceMarkIcon from '../../assets/icons/PlaceMark.svg' @@ -151,6 +151,16 @@ export default function NoteFooter({ icon={} /> } + {editMode && + + } + onClick={() => submitUpdate(repository, accessToken, id)} + /> + + } {numberOfComments > 0 && !editMode && @@ -163,28 +173,19 @@ export default function NoteFooter({ icon={} /> } + {!selected && numberOfComments} } {!isNote && user && username === user.nickname && - - } - onClick={() => deleteComment(id)} - /> + + } + onClick={() => deleteComment(id)} + /> } - {editMode && - - } - onClick={() => submitUpdate(repository, accessToken, id)} - /> - - } ) } From 70a592526be58c30e7f01060c6bae04620fbe49f Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Wed, 29 May 2024 12:53:58 +0200 Subject: [PATCH 07/14] add the test --- cypress/e2e/notes-100/comment-delete.cy.js | 27 ++++++++++++++++++++++ src/Components/Notes/NoteFooter.jsx | 17 +++++++------- 2 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 cypress/e2e/notes-100/comment-delete.cy.js diff --git a/cypress/e2e/notes-100/comment-delete.cy.js b/cypress/e2e/notes-100/comment-delete.cy.js new file mode 100644 index 000000000..3f727a6bc --- /dev/null +++ b/cypress/e2e/notes-100/comment-delete.cy.js @@ -0,0 +1,27 @@ +import '@percy/cypress' +import { + homepageSetup, + returningUserVisitsHomepageWaitForModel, + auth0Login, +} from '../../support/utils' + +/** {@link https://github.com/bldrs-ai/Share/issues/1187} */ +describe('Notes 100: Comment delete', () => { + beforeEach(homepageSetup) + context('Returning user visits homepage', () => { + beforeEach(returningUserVisitsHomepageWaitForModel) + context('Open Notes > first note', () => { + beforeEach(() => { + cy.get('[data-testid="control-button-notes"]').click() + cy.get('[data-testid="list-notes"] :nth-child(1) > [data-testid="note-body"]').first().click() + }) + it('Deleted comment disappears from the list', () => { + auth0Login() + cy.get(`[data-testid="list-notes"] > :nth-child(3) + > [data-testid="note-card"] > .MuiCardActions-root > .MuiBox-root > [data-testid="deleteComment"]`).click() + cy.get('[data-testid="list-notes"] > :nth-child(3) > [data-testid="note-card"]').should('not.contain', 'testComment_1') + cy.percySnapshot() + }) + }) + }) +}) diff --git a/src/Components/Notes/NoteFooter.jsx b/src/Components/Notes/NoteFooter.jsx index 427bf8716..2512adc90 100644 --- a/src/Components/Notes/NoteFooter.jsx +++ b/src/Components/Notes/NoteFooter.jsx @@ -72,7 +72,7 @@ export default function NoteFooter({ } aboutInfo={false} @@ -83,7 +83,7 @@ export default function NoteFooter({ } aboutInfo={false} @@ -93,7 +93,7 @@ export default function NoteFooter({ { onClickShare() setShareIssue(!shareIssue) @@ -116,7 +116,7 @@ export default function NoteFooter({ { togglePlaceMarkActive(id) }} @@ -133,7 +133,7 @@ export default function NoteFooter({ { setScreenshotUri(viewer.takeScreenshot()) }} @@ -145,7 +145,7 @@ export default function NoteFooter({ } @@ -155,7 +155,7 @@ export default function NoteFooter({ } onClick={() => submitUpdate(repository, accessToken, id)} /> @@ -168,7 +168,7 @@ export default function NoteFooter({ } /> @@ -181,6 +181,7 @@ export default function NoteFooter({ } onClick={() => deleteComment(id)} /> From 5569da7e18fb37194bb4de8de10217fb1c98668f Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Wed, 29 May 2024 13:31:19 +0200 Subject: [PATCH 08/14] clean up --- src/Components/Notes/Notes.jsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Components/Notes/Notes.jsx b/src/Components/Notes/Notes.jsx index 23ea477ce..fa2ebcd03 100644 --- a/src/Components/Notes/Notes.jsx +++ b/src/Components/Notes/Notes.jsx @@ -30,13 +30,10 @@ export default function Notes() { const repository = useStore((state) => state.repository) const selectedNoteId = useStore((state) => state.selectedNoteId) const setComments = useStore((state) => state.setComments) - console.log('comments', comments) - const [hasError, setHasError] = useState(false) const {user} = useAuth0() const isMobile = useIsMobile() - console.log('user', user) const selectedNote = (notes && selectedNoteId) ? From c53803eac77efd37aa055812e6014a4f4488f74c Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Tue, 4 Jun 2024 10:53:47 +0200 Subject: [PATCH 09/14] resolve the notes problem --- src/Components/Notes/Notes.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Components/Notes/Notes.jsx b/src/Components/Notes/Notes.jsx index fa2ebcd03..29b2b93f8 100644 --- a/src/Components/Notes/Notes.jsx +++ b/src/Components/Notes/Notes.jsx @@ -1,4 +1,3 @@ -/* eslint-disable no-console */ import React, {ReactElement, useEffect, useState} from 'react' import Box from '@mui/material/Box' import List from '@mui/material/List' From ca17361118db145aff0e6080f763b25e4206205a Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Wed, 5 Jun 2024 14:58:58 +0200 Subject: [PATCH 10/14] response --- src/Components/Notes/NoteCard.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Components/Notes/NoteCard.jsx b/src/Components/Notes/NoteCard.jsx index 1e1033621..e369092c5 100644 --- a/src/Components/Notes/NoteCard.jsx +++ b/src/Components/Notes/NoteCard.jsx @@ -160,7 +160,8 @@ export default function NoteCard({ * @param {number} commentId */ async function deleteCommentGithub(commentId) { - await deleteComment(repository, commentId, accessToken) + // eslint-disable-next-line no-unused-vars + const res = await deleteComment(repository, commentId, accessToken) const newComments = comments.filter((comment) => comment.id !== commentId) setComments(newComments) } From e88b57d5efb6968adbb116acc87b664937fafeab Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Wed, 5 Jun 2024 22:46:05 +0200 Subject: [PATCH 11/14] address comments --- src/Components/Notes/NoteFooter.jsx | 46 +++++++++++++---------------- src/__mocks__/api-handlers.js | 2 +- src/net/github/Comments.test.js | 2 +- 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/Components/Notes/NoteFooter.jsx b/src/Components/Notes/NoteFooter.jsx index 2512adc90..276268f29 100644 --- a/src/Components/Notes/NoteFooter.jsx +++ b/src/Components/Notes/NoteFooter.jsx @@ -151,33 +151,29 @@ export default function NoteFooter({ icon={} /> } - {editMode && - - } - onClick={() => submitUpdate(repository, accessToken, id)} - /> - - } - {numberOfComments > 0 && !editMode && - - {!selected && + + {editMode && } + icon={} + onClick={() => submitUpdate(repository, accessToken, id)} /> - } - {!selected && numberOfComments} - - } - {!isNote && user && username === user.nickname && - + } + {!selected && numberOfComments > 0 && !editMode && + <> + } + /> + {numberOfComments} + + } + {!isNote && user && username === user.nickname && } onClick={() => deleteComment(id)} /> - - } + } + ) } diff --git a/src/__mocks__/api-handlers.js b/src/__mocks__/api-handlers.js index 42daa3c6e..000049f92 100644 --- a/src/__mocks__/api-handlers.js +++ b/src/__mocks__/api-handlers.js @@ -235,7 +235,7 @@ function githubHandlers(githubStore) { rest.delete(`${GH_BASE}/repos/:org/:repo/issues/comments/:commentId`, (req, res, ctx) => { const {org, repo, commentId} = req.params - if (org !== 'pablo-mayrgundter' || repo !== 'Share' || !commentId) { + if (org !== 'cypresstester' || repo !== 'Share' || !commentId) { return res(ctx.status(httpNotFound)) } diff --git a/src/net/github/Comments.test.js b/src/net/github/Comments.test.js index a3ad4f889..6224cf744 100644 --- a/src/net/github/Comments.test.js +++ b/src/net/github/Comments.test.js @@ -14,7 +14,7 @@ describe('net/github/Comments', () => { }) it('successfully delete comment', async () => { - const res = await deleteComment({orgName: 'pablo-mayrgundter', name: 'Share'}, 1) + const res = await deleteComment({orgName: 'cypresstester', name: 'Share'}, 1) expect(res.status).toEqual(httpOK) }) }) From fd30fef5f4c9a7ac5ea9ca8a1a573b8f95ecf905 Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Tue, 18 Jun 2024 12:39:44 +0200 Subject: [PATCH 12/14] change the test to cypressTester org --- src/__mocks__/api-handlers.js | 2 +- src/net/github/Comments.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__mocks__/api-handlers.js b/src/__mocks__/api-handlers.js index 000049f92..321af0d8f 100644 --- a/src/__mocks__/api-handlers.js +++ b/src/__mocks__/api-handlers.js @@ -208,7 +208,7 @@ function githubHandlers(githubStore) { rest.post(`${GH_BASE}/repos/:org/:repo/issues/:issueNumber/comments`, (req, res, ctx) => { const {org, repo, issueNumber} = req.params - if (org !== 'pablo-mayrgundter' || repo !== 'Share' || !issueNumber) { + if (org !== 'cypresstester' || repo !== 'Share' || !issueNumber) { return res(ctx.status(httpNotFound)) } return res( diff --git a/src/net/github/Comments.test.js b/src/net/github/Comments.test.js index 6224cf744..e95f51c7e 100644 --- a/src/net/github/Comments.test.js +++ b/src/net/github/Comments.test.js @@ -9,7 +9,7 @@ const httpCreated = 201 describe('net/github/Comments', () => { it('successfully create comment', async () => { - const res = await createComment({orgName: 'pablo-mayrgundter', name: 'Share'}, 1, {title: 'title', body: 'body'}) + const res = await createComment({orgName: 'cypresstester', name: 'Share'}, 1, {title: 'title', body: 'body'}) expect(res.status).toEqual(httpCreated) }) From 6d15768288674b70104df883be3399572b90016e Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Tue, 18 Jun 2024 13:22:06 +0200 Subject: [PATCH 13/14] fix e2e test --- src/__mocks__/api-handlers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__mocks__/api-handlers.js b/src/__mocks__/api-handlers.js index 321af0d8f..3abc8f2d5 100644 --- a/src/__mocks__/api-handlers.js +++ b/src/__mocks__/api-handlers.js @@ -233,9 +233,9 @@ function githubHandlers(githubStore) { }), rest.delete(`${GH_BASE}/repos/:org/:repo/issues/comments/:commentId`, (req, res, ctx) => { - const {org, repo, commentId} = req.params + const {repo, commentId} = req.params - if (org !== 'cypresstester' || repo !== 'Share' || !commentId) { + if (repo !== 'Share' || !commentId) { return res(ctx.status(httpNotFound)) } From d37f1c8db804f2a1b627e45a36d486fdcf6f4a3e Mon Sep 17 00:00:00 2001 From: OlegMoshkovich Date: Tue, 18 Jun 2024 14:02:27 +0200 Subject: [PATCH 14/14] leave todo --- package.json | 2 +- src/__mocks__/api-handlers.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9d2b28347..79726ee09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bldrs", - "version": "1.0.1073", + "version": "1.0.1072", "main": "src/index.jsx", "license": "AGPL-3.0", "homepage": "https://github.com/bldrs-ai/Share", diff --git a/src/__mocks__/api-handlers.js b/src/__mocks__/api-handlers.js index 3abc8f2d5..aa378e091 100644 --- a/src/__mocks__/api-handlers.js +++ b/src/__mocks__/api-handlers.js @@ -66,7 +66,7 @@ function githubHandlers(githubStore) { rest.get(`${GH_BASE}/repos/:org/:repo/issues/:issueNumber/comments`, (req, res, ctx) => { const {org, repo, issueNumber} = req.params - + // TODO(oleg) replace org with cypresstester https://github.com/bldrs-ai/Share/issues/1218 if (org !== 'pablo-mayrgundter' || repo !== 'Share' || !issueNumber) { return res(ctx.status(httpNotFound)) } @@ -218,6 +218,7 @@ function githubHandlers(githubStore) { rest.patch(`${GH_BASE}/repos/:org/:repo/issues/:issueNumber`, (req, res, ctx) => { const {org, repo} = req.params + // TODO(oleg) add org cypresstester condition https://github.com/bldrs-ai/Share/issues/1218 if (org !== 'pablo-mayrgundter' || repo !== 'Share' ) { return res( ctx.status(httpNotFound), @@ -234,7 +235,7 @@ function githubHandlers(githubStore) { rest.delete(`${GH_BASE}/repos/:org/:repo/issues/comments/:commentId`, (req, res, ctx) => { const {repo, commentId} = req.params - + // TODO(oleg) add org cypresstester condition https://github.com/bldrs-ai/Share/issues/1218 if (repo !== 'Share' || !commentId) { return res(ctx.status(httpNotFound)) }