-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(package-properites): definied initial list of properties to sort…
… in a package.json
- Loading branch information
Showing
10 changed files
with
96 additions
and
23 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import {assert} from 'chai'; | ||
import any from '@travi/any'; | ||
import sinon from 'sinon'; | ||
|
||
import * as sortObjectKeys from '../../thirdparty-wrappers/sort-object-keys'; | ||
import sortProperties from './property-sorter'; | ||
|
||
suite('package.json property sorter', () => { | ||
let sandbox; | ||
|
||
setup(() => { | ||
sandbox = sinon.createSandbox(); | ||
|
||
sandbox.stub(sortObjectKeys, 'default'); | ||
}); | ||
|
||
teardown(() => sandbox.restore()); | ||
|
||
test('that package properties are sorted based on the defined order', async () => { | ||
const packageContents = any.simpleObject(); | ||
const sortedPackageContents = any.simpleObject(); | ||
sortObjectKeys.default | ||
.withArgs( | ||
packageContents, | ||
['name', 'keywords', 'engines', 'scripts', 'dependencies', 'devDependencies', 'peerDependencies'] | ||
) | ||
.returns(sortedPackageContents); | ||
|
||
assert.deepEqual(sortProperties(packageContents), sortedPackageContents); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import sortProperties from '../../thirdparty-wrappers/sort-object-keys'; | ||
|
||
export default function (packageContents) { | ||
return sortProperties( | ||
packageContents, | ||
['name', 'keywords', 'engines', 'scripts', 'dependencies', 'devDependencies', 'peerDependencies'] | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import sortObjectKeys from 'sort-object-keys'; | ||
|
||
export default sortObjectKeys; |