forked from MapComplete/MapComplete
Port tests to vitest
This commit is contained in:
parent
64a4d7e929
commit
228ceb120d
33 changed files with 673 additions and 326 deletions
|
@ -1,10 +1,9 @@
|
|||
import { describe } from "mocha"
|
||||
import { TagRenderingConfigJson } from "../../../Models/ThemeConfig/Json/TagRenderingConfigJson"
|
||||
import TagRenderingConfig from "../../../Models/ThemeConfig/TagRenderingConfig"
|
||||
import TagRenderingQuestion from "../../../UI/Popup/TagRenderingQuestion"
|
||||
import { UIEventSource } from "../../../Logic/UIEventSource"
|
||||
import { expect } from "chai"
|
||||
import Locale from "../../../UI/i18n/Locale"
|
||||
import { describe, expect, it } from "vitest"
|
||||
|
||||
describe("TagRenderingQuestion", () => {
|
||||
it("should have a freeform text field with the user defined placeholder", () => {
|
||||
|
@ -21,7 +20,7 @@ describe("TagRenderingQuestion", () => {
|
|||
const config = new TagRenderingConfig(configJson, "test")
|
||||
const ui = new TagRenderingQuestion(new UIEventSource<any>({}), config)
|
||||
const html = ui.ConstructElement()
|
||||
expect(html.getElementsByTagName("input")[0]["placeholder"]).eq(
|
||||
expect(html.getElementsByTagName("input")[0]["placeholder"]).toBe(
|
||||
"Some user defined placeholder"
|
||||
)
|
||||
})
|
||||
|
@ -40,7 +39,7 @@ describe("TagRenderingQuestion", () => {
|
|||
const config = new TagRenderingConfig(configJson, "test")
|
||||
const ui = new TagRenderingQuestion(new UIEventSource<any>({}), config)
|
||||
const html = ui.ConstructElement()
|
||||
expect(html.getElementsByTagName("input")[0]["placeholder"]).eq(
|
||||
expect(html.getElementsByTagName("input")[0]["placeholder"]).toBe(
|
||||
"capacity (a positive, whole number)"
|
||||
)
|
||||
})
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
import { describe } from "mocha"
|
||||
import SpecialVisualizations from "../../UI/SpecialVisualizations"
|
||||
import { expect } from "chai"
|
||||
import { describe, expect, it } from "vitest"
|
||||
|
||||
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"
|
||||
)
|
||||
expect(special.funcName).not.toBe("type")
|
||||
|
||||
if (special.args === undefined) {
|
||||
throw (
|
||||
|
@ -20,10 +16,7 @@ describe("SpecialVisualisations", () => {
|
|||
}
|
||||
|
||||
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"
|
||||
)
|
||||
expect(arg.name).not.toBe("type")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue