From 587a1341c83ef4fc1cf3353d35b09435a11f8217 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Sat, 6 Jan 2024 18:28:05 +0100 Subject: [PATCH] Add an unicity test for features. (#824) And remove one duplicate --- data/pc/common/features.json | 8 -------- tools/js/test/test.js | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/data/pc/common/features.json b/data/pc/common/features.json index 69fca68b3..1bf25b8cc 100644 --- a/data/pc/common/features.json +++ b/data/pc/common/features.json @@ -289,14 +289,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", diff --git a/tools/js/test/test.js b/tools/js/test/test.js index 26dfae889..fe75d24f0 100644 --- a/tools/js/test/test.js +++ b/tools/js/test/test.js @@ -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.`) + }) + }) })