mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #3559 from overleaf/ta-file-tree-404-fix
[ReactFileTree] Fix Handling of 404 on Deletion GitOrigin-RevId: 8b955710929246168ac5cc29acda7a893164fc1d
This commit is contained in:
parent
dc48ba1d61
commit
5f9544ad69
2 changed files with 14 additions and 1 deletions
|
@ -179,7 +179,7 @@ export function useFileTreeActionable() {
|
|||
return syncDelete(projectId, found.type, found.entity._id).catch(
|
||||
error => {
|
||||
// throw unless 404
|
||||
if (error.info.statusCode !== '404') {
|
||||
if (error.info.statusCode !== 404) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,6 +74,9 @@ describe('FileTree Delete Entity Flow', function() {
|
|||
name: 'main.tex'
|
||||
})
|
||||
).to.not.exist
|
||||
|
||||
// check that the confirmation modal is closed
|
||||
expect(screen.queryByText(/Are you sure/)).to.not.exist
|
||||
})
|
||||
|
||||
const [lastFetchPath] = fetchMock.lastCall(fetchMatcher)
|
||||
|
@ -88,6 +91,9 @@ describe('FileTree Delete Entity Flow', function() {
|
|||
|
||||
window._ide.socket.socketClient.emit('removeEntity', '456def')
|
||||
|
||||
// check that the confirmation modal is open
|
||||
screen.getByText(/Are you sure/)
|
||||
|
||||
await waitFor(() => {
|
||||
expect(
|
||||
screen.queryByRole('treeitem', {
|
||||
|
@ -101,6 +107,10 @@ describe('FileTree Delete Entity Flow', function() {
|
|||
name: 'main.tex'
|
||||
})
|
||||
).to.not.exist
|
||||
|
||||
// check that the confirmation modal is closed
|
||||
// is not, the 404 probably triggered a bug
|
||||
expect(screen.queryByText(/Are you sure/)).to.not.exist
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -228,6 +238,9 @@ describe('FileTree Delete Entity Flow', function() {
|
|||
name
|
||||
})
|
||||
).to.not.exist
|
||||
|
||||
// check that the confirmation modal is closed
|
||||
expect(screen.queryByText(/Are you sure/)).to.not.exist
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue