Browse Source

Merge pull request #1953 from transloadit/test-node-6

companion: test companion on node 6 + fix incompatible code
Ifedapo .A. Olarewaju 5 years ago
parent
commit
8954988157

+ 6 - 1
.travis.yml

@@ -48,6 +48,10 @@ matrix:
       env: COMPANION=true
       addons:
         apt: *APT
+    - node_js: 'stable'
+      env: COMPANION_NODE6=true
+      addons:
+        apt: *APT
     # Build the website when things are merged to master
     - node_js: 10
       env: WEBSITE=true
@@ -62,7 +66,8 @@ script:
 - 'if [ -n "${LINT-}" ]; then npm run lint; fi'
 - 'if [ -n "${LINT-}" ]; then npm run test:type; fi'
 - 'if [ -n "${UNIT-}" ]; then npm run test:unit; fi'
-- 'if [ -n "${COMPANION-}" ]; then npm run test:companion; fi'
+- 'if [ -n "${COMPANION_NODE6-}" ]; then nvm install 6.0.0 && nvm use 6.0.0; fi'
+- 'if [ -n "${COMPANION-}" ] || [ -n "${COMPANION_NODE6-}" ]; then npm run test:companion; fi'
 - 'if [ -n "${ENDTOEND-}" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then npm run test:endtoend; fi'
 - 'if [ -n "${BUILD-}" ]; then npm run build; fi'
 # Publish release commits to CDN after a `BUILD=true` run, because we have all the files now

+ 2 - 3
packages/@uppy/companion/src/server/provider/drive/adapter.js

@@ -75,9 +75,8 @@ exports.getNextPagePath = (data, currentQuery, currentPath) => {
   if (!data.nextPageToken) {
     return null
   }
-  const query = {
-    ...currentQuery,
+  const query = Object.assign({}, currentQuery, {
     cursor: data.nextPageToken
-  }
+  })
   return `${currentPath}?${querystring.stringify(query)}`
 }

+ 3 - 3
packages/@uppy/companion/src/server/provider/facebook/adapter.js

@@ -43,10 +43,10 @@ exports.getNextPagePath = (data, currentQuery, currentPath) => {
   if (!data.paging || !data.paging.cursors) {
     return null
   }
-  const query = {
-    ...currentQuery,
+
+  const query = Object.assign({}, currentQuery, {
     cursor: data.paging.cursors.after
-  }
+  })
   return `${currentPath || ''}?${querystring.stringify(query)}`
 }
 

+ 2 - 3
packages/@uppy/companion/src/server/provider/instagram/adapter.js

@@ -14,12 +14,11 @@ exports.getItemSubList = (item) => {
   item.data.forEach((subItem) => {
     if (subItem.carousel_media) {
       subItem.carousel_media.forEach((i, index) => {
-        const newSubItem = {
-          ...i,
+        const newSubItem = Object.assign({}, i, {
           id: subItem.id,
           created_time: subItem.created_time,
           carousel_id: index
-        }
+        })
         subItems.push(newSubItem)
       })
     } else {