-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: sort packages after insert (#11332)
inserted without adjusting other property positions --------- Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
- Loading branch information
1 parent
f7c44e1
commit f0dcc76
Showing
3 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
'svelte-migrate': patch | ||
--- | ||
|
||
chore: insert package at sorted position |
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,73 @@ | ||
import { assert, test } from 'vitest'; | ||
import { update_pkg } from './utils.js'; | ||
|
||
test('Inserts package at correct position (1)', () => { | ||
const result = update_pkg( | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"z": "3", | ||
"c": "4" | ||
} | ||
}`, | ||
[['b', '2', '', 'dependencies']] | ||
); | ||
|
||
assert.equal( | ||
result, | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2", | ||
"z": "3", | ||
"c": "4" | ||
} | ||
}` | ||
); | ||
}); | ||
|
||
test('Inserts package at correct position (2)', () => { | ||
const result = update_pkg( | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2" | ||
} | ||
}`, | ||
[['c', '3', '', 'dependencies']] | ||
); | ||
|
||
assert.equal( | ||
result, | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2", | ||
"c": "3" | ||
} | ||
}` | ||
); | ||
}); | ||
|
||
test('Inserts package at correct position (3)', () => { | ||
const result = update_pkg( | ||
`{ | ||
"dependencies": { | ||
"b": "2", | ||
"c": "3" | ||
} | ||
}`, | ||
[['a', '1', '', 'dependencies']] | ||
); | ||
|
||
assert.equal( | ||
result, | ||
`{ | ||
"dependencies": { | ||
"a": "1", | ||
"b": "2", | ||
"c": "3" | ||
} | ||
}` | ||
); | ||
}); |