upload.ts 478 B

1234567891011121314151617
  1. export const interceptFileUpload = () => {
  2. cy.intercept(
  3. { method: 'POST', url: /\/project\/.*\/upload/ },
  4. cy
  5. .spy(req => {
  6. const folderMatch = req.url.match(
  7. /project\/.*\/upload\?folder_id=[a-f0-9]{24}/
  8. )
  9. if (folderMatch) {
  10. req.reply({ statusCode: 200, body: { success: true } })
  11. } else {
  12. req.reply({ statusCode: 500, body: { success: false } })
  13. }
  14. })
  15. .as('uploadRequest')
  16. )
  17. }