Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
fix(test): Fix test and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaledgarbaya committed Nov 15, 2016
1 parent 2cbb12d commit d012e38
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions lib/get-transformed-destination-response.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import log from 'npmlog'
import {map} from 'lodash/collection'
import { map } from 'lodash/collection'
import getOutdatedDestinationContent from 'contentful-batch-libs/get/get-outdated-destination-content'

/**
* Gets the response from the destination space with the content that needs
* to be updated. If it's the initial sync, and content exists, we abort
* and tell the user why.
*/
export default function getTransformedDestinationResponse ({
managementClient,
spaceId,
sourceResponse,
skipContentModel
}) {
export default function getTransformedDestinationResponse ({managementClient, spaceId, sourceResponse, skipContentModel}) {
return getOutdatedDestinationContent({
managementClient: managementClient,
spaceId: spaceId,
Expand All @@ -21,13 +16,13 @@ export default function getTransformedDestinationResponse ({
assetIds: map(sourceResponse.assets, 'sys.id')
})
.then((destinationResponse) => {
if (skipContentModel) {
destinationResponse.contentTypes = []
destinationResponse.locales = []
}
if (skipContentModel) {
destinationResponse.contentTypes = []
destinationResponse.locales = []
}

if (sourceResponse.isInitialSync && (destinationResponse.contentTypes.length > 0 || destinationResponse.assets.length > 0)) {
log.error(`
if (sourceResponse.isInitialSync && (destinationResponse.contentTypes.length > 0 || destinationResponse.assets.length > 0)) {
log.error(`
Your destination space already has some content.
If you have a token file, please place it on the same directory which you are currently in.
Expand All @@ -37,8 +32,8 @@ Otherwise, please run this tool on an empty space.
If you'd like more information, please consult the README at:
https://github.com/contentful/contentful-space-sync
`)
process.exit(1)
}
return destinationResponse
})
process.exit(1)
}
return destinationResponse
})
}

0 comments on commit d012e38

Please sign in to comment.