Skip to content

Commit 50997ac

Browse files
committed
Assert structural identity between manifests
Order of the keys in the manifest JSON should not matter
1 parent f4f0eeb commit 50997ac

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"devDependencies": {
2424
"eslint": "^4.4.1",
2525
"eslint-config-fnd": "^1.2.0",
26+
"json-diff": "^0.5.2",
2627
"node-hook": "^1.0.0",
2728
"release-util-fnd": "^1.0.5"
2829
}

test/run

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ function assert_identical {
2626
fail "files \`$actual\` and \`$expected\` are not identical"
2727
}
2828

29+
function assert_identical_json {
30+
actual="${1:?}"
31+
expected="${2:?}"
32+
json-diff "$expected" "$actual" || \
33+
fail "files \`$actual\` and \`$expected\` are not identical"
34+
}
35+
2936
function assert_manifest {
3037
asset_path="${1:?}"
3138
uri="${2:?}"
@@ -62,12 +69,12 @@ end
6269
begin "./test_fingerprint"
6370
faucet
6471
assert_identical "./dist/test-e59ff97941044f85df5297e1c302d260.txt" "./src/test.txt"
65-
assert_identical "./dist/manifest.json" "./expected.json"
72+
assert_identical_json "./dist/manifest.json" "./expected.json"
6673
end
6774

6875
begin "./test_manifest_base_uri"
6976
faucet
70-
assert_identical "./dist/manifest.json" "./expected.json"
77+
assert_identical_json "./dist/manifest.json" "./expected.json"
7178
end
7279

7380
begin "./test_single"

0 commit comments

Comments
 (0)