浏览代码

fix broken onedrive and broken tests

Mikael Finstad 2 年之前
父节点
当前提交
2db5165bd8

+ 1 - 1
packages/@uppy/companion/src/server/provider/onedrive/index.js

@@ -7,7 +7,7 @@ const { withProviderErrorHandling } = require('../providerErrors')
 const { prepareStream } = require('../../helpers/utils')
 
 const getClient = ({ token }) => got.extend({
-  prefixUrl: 'https://graph.microsoft.com',
+  prefixUrl: 'https://graph.microsoft.com/v1.0',
   headers: {
     authorization: `Bearer ${token}`,
   },

+ 4 - 4
packages/@uppy/companion/test/__tests__/providers.js

@@ -227,11 +227,11 @@ describe('list provider files', () => {
   })
 
   test('onedrive', async () => {
-    nock('https://graph.microsoft.com').get('/me').reply(200, {
+    nock('https://graph.microsoft.com').get('/v1.0/me').reply(200, {
       userPrincipalName: defaults.USERNAME,
       mail: defaults.USERNAME,
     })
-    nock('https://graph.microsoft.com').get('/me/drive/root/children?%24expand=thumbnails').reply(200, {
+    nock('https://graph.microsoft.com').get('/v1.0/me/drive/root/children?%24expand=thumbnails').reply(200, {
       value: [
         {
           createdDateTime: '2020-01-31T15:40:26.197Z',
@@ -354,10 +354,10 @@ describe('provider file gets downloaded from', () => {
   })
 
   test('onedrive', async () => {
-    nock('https://graph.microsoft.com').get(`/drives/DUMMY-DRIVE-ID/items/${defaults.ITEM_ID}`).reply(200, {
+    nock('https://graph.microsoft.com').get(`/v1.0/drives/DUMMY-DRIVE-ID/items/${defaults.ITEM_ID}`).reply(200, {
       size: defaults.FILE_SIZE,
     })
-    nock('https://graph.microsoft.com').get(`/drives/DUMMY-DRIVE-ID/items/${defaults.ITEM_ID}/content`).reply(200, {})
+    nock('https://graph.microsoft.com').get(`/v1.0/drives/DUMMY-DRIVE-ID/items/${defaults.ITEM_ID}/content`).reply(200, {})
     await runTest('onedrive')
   })