Files
minecraft-data/tools/js/test/audit_datapaths.js
extremeheat 2ced2b3bfc bedrock: version data parity, block state and protocol fixes (#507)
* version.json pairity

* fix command block update packet

* Update version_schema.json

* correct animate packet boat field

* correct releaseType field

* update blockstate data

* add dataPath audit

* move block data from 1.18.0 -> 1.17.40

* update dataPaths audit to check path validity
2022-01-28 16:01:45 +01:00

34 lines
1.1 KiB
JavaScript

/* eslint-env mocha */
const fs = require('fs')
const { join } = require('path')
const assert = require('assert')
describe('audit dataPaths', function () {
const dataPaths = require('../../../data/dataPaths.json')
it('should have a dataPath for each file', function () {
require('./version_iterator')(function (p, versionString) {
const [type, version] = versionString.split(' ')
const dp = dataPaths[type][version]
const files = fs.readdirSync(p).map(f => f.split('.')[0])
for (const file of files) {
assert(dp[file], `missing dataPath for ${type} ${version} ${file}`)
}
})
})
it('dataPath should point to valid files', function () {
for (const version in dataPaths) {
for (const type in dataPaths[version]) {
const dp = dataPaths[version][type]
for (const file in dp) {
const path = dp[file]
const p = join(__dirname, '../../../data/' + path + '/' + file)
const exists = fs.existsSync(p + '.json') || fs.existsSync(p + '.yml')
assert(exists, `missing file for ${type} ${version} ${file}, path: ${p}`)
}
}
}
})
})