Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an unicity test for features. #824

Merged
merged 1 commit into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions data/pc/common/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,6 @@
"description": "dimension is an nbt compound",
"versions": ["1.16.2", "latest"]
},
{
"name": "dimensionDataIsAvailable",
"description": "dimensionData is available, describing additional dimension information",
"versions": [
"1.17",
"latest"
]
},
{
"name": "doesntHaveChestType",
"description": "chests don't have a type property",
Expand Down
17 changes: 17 additions & 0 deletions tools/js/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,21 @@ minecraftTypes.forEach(function (type) {
})
})
})
describe('features.json quality is good', function () {
it('there is no duplicate feature in features.json', () => {
const features = require('../../../data/' + type + '/common/features.json')
const countPerFeature = {}
for (const feature of features) {
countPerFeature[feature.name] = countPerFeature[feature.name] ? countPerFeature[feature.name] + 1 : 1
}
let duplicateCount = 0
for (const [name, count] of Object.entries(countPerFeature)) {
if (count > 1) {
console.log(`feature ${name} is duplicated ${count} times, please remove ${count - 1}`)
duplicateCount += 1
}
}
assert.equal(duplicateCount, 0, `${duplicateCount} duplicates found. Please remove them.`)
})
})
})
Loading