ext-saladict icon indicating copy to clipboard operation
ext-saladict copied to clipboard

Yarn test failed with `Sync service WebDAV › initServer › should reject with "mkcol" if cannot create dir`

Open hsiong opened this issue 2 years ago • 0 comments

Device info

  • OS: macOS Monterey 12.5
  • Saladict Version: dev branch
  • yarn Version: 1.22.19
  • node-fetch Version: ^2.6.7 I changed node-fetch version reference to https://github.com/crimx/ext-saladict/issues/1779 .

Describe the bug

When running yarn test, the result is :
Test Suites: 1 failed, 21 passed, 22 of 35 total

The following is my log:

 FAIL  test/specs/background/sync-manager/services/webdav.spec.ts
  ● Sync service WebDAV › initServer › should do nothing if local files are older

    exist

      193 |       // An old file exists on server.
      194 |       // Let user decide whether to upload.
    > 195 |       throw new Error('exist')
          |             ^
      196 |     }
      197 |   }
      198 |

      at Service.init (src/background/sync-manager/services/webdav/index.ts:195:13)
      at Object.<anonymous> (test/specs/background/sync-manager/services/webdav.spec.ts:566:7)

  ● Sync service WebDAV › initServer › should reject with "mkcol" if cannot create dir

    expect(received).toBe(expected) // Object.is equality

    Expected: "mkcol"
    Received: "exist"

      643 |         await service.init()
      644 |       } catch (e) {
    > 645 |         expect(e.message).toBe('mkcol')
          |                           ^
      646 |       }
      647 |
      648 |       expect(service.download).toHaveBeenCalledTimes(0)

      at Object.<anonymous> (test/specs/background/sync-manager/services/webdav.spec.ts:645:27)

Summary of all failing tests
 FAIL  test/specs/background/sync-manager/services/webdav.spec.ts
  ● Sync service WebDAV › initServer › should do nothing if local files are older

    exist

      193 |       // An old file exists on server.
      194 |       // Let user decide whether to upload.
    > 195 |       throw new Error('exist')
          |             ^
      196 |     }
      197 |   }
      198 |

      at Service.init (src/background/sync-manager/services/webdav/index.ts:195:13)
      at Object.<anonymous> (test/specs/background/sync-manager/services/webdav.spec.ts:566:7)

  ● Sync service WebDAV › initServer › should reject with "mkcol" if cannot create dir

    expect(received).toBe(expected) // Object.is equality

    Expected: "mkcol"
    Received: "exist"

      643 |         await service.init()
      644 |       } catch (e) {
    > 645 |         expect(e.message).toBe('mkcol')
          |                           ^
      646 |       }
      647 |
      648 |       expect(service.download).toHaveBeenCalledTimes(0)

      at Object.<anonymous> (test/specs/background/sync-manager/services/webdav.spec.ts:645:27)


Test Suites: 1 failed, 21 passed, 22 of 35 total
Tests:       2 failed, 105 passed, 107 total
Snapshots:   0 total
Time:        10.787 s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior

Once the command yarn test is completed, the result might be all passed.

hsiong avatar Aug 11 '22 09:08 hsiong