Rename tests to test; add a few tests

This commit is contained in:
Pieter Vander Vennet 2022-04-06 03:06:28 +02:00
parent df706d2f97
commit c3859d56c6
28 changed files with 33 additions and 5 deletions

View file

@ -0,0 +1,19 @@
import {describe} from 'mocha'
import SpecialVisualizations from "../../UI/SpecialVisualizations";
import {expect} from "chai";
describe("SpecialVisualisations", () => {
describe("predifined special visualisations", () => {
it("should not have an argument called 'type'", () => {
const specials = SpecialVisualizations.specialVisualizations
for (const special of specials) {
expect(special.funcName).not.eq('type', "A special visualisation is not allowed to be named 'type', as this will conflict with the 'special'-blocks")
for (const arg of special.args) {
expect(arg.name).not.eq('type', "An argument is not allowed to be called 'type', as this will conflict with the 'special'-blocks")
}
}
})
})
})

View file

@ -0,0 +1,14 @@
import {describe} from 'mocha'
import {expect} from 'chai'
import Translations from "../../UI/i18n/Translations";
import ValidatedTextField from "../../UI/Input/ValidatedTextField";
describe("ValidatedTextFields", () => {
it("should all have description in the translations", () => {
const ts = Translations.t.validation;
const missingTranslations = Array.from(ValidatedTextField.allTypes.keys())
.filter(key => ts[key] === undefined || ts[key].description === undefined)
expect(missingTranslations, "These validated text fields don't have a type name defined in en.json. (Did you just add one? Run `npm run generate:translations`)").to.be.empty
})
})