Chore: reformat all files with prettier

This commit is contained in:
Pieter Vander Vennet 2023-06-14 20:39:36 +02:00
parent 5757ae5dea
commit d008dcb54d
214 changed files with 8926 additions and 8196 deletions

View file

@ -85,7 +85,7 @@ describe("Code quality", () => {
"innerText is not allowed as it is not testable with fakeDom. Use 'textContent' instead."
)
)
/*
/*
itAsync(
"should not contain 'import * as name from \"xyz.json\"'",
detectInCode(

View file

@ -1,12 +1,12 @@
import {Utils} from "../../../Utils"
import { Utils } from "../../../Utils"
import LayoutConfig from "../../../Models/ThemeConfig/LayoutConfig"
import * as bookcaseJson from "../../../assets/generated/themes/bookcases.json"
import {OsmTags} from "../../../Models/OsmFeature"
import {Feature, Geometry} from "geojson"
import {expect, it} from "vitest"
import { OsmTags } from "../../../Models/OsmFeature"
import { Feature, Geometry } from "geojson"
import { expect, it } from "vitest"
import ThemeViewState from "../../../Models/ThemeViewState"
import ScriptUtils from "../../../scripts/ScriptUtils";
import ScriptUtils from "../../../scripts/ScriptUtils"
const latestTags = {
amenity: "public_bookcase",

View file

@ -1,7 +1,7 @@
import {ExtraFuncParams, ExtraFunctions} from "../../Logic/ExtraFunctions"
import {OsmFeature} from "../../Models/OsmFeature"
import {describe, expect, it} from "vitest"
import {Feature} from "geojson";
import { ExtraFuncParams, ExtraFunctions } from "../../Logic/ExtraFunctions"
import { OsmFeature } from "../../Models/OsmFeature"
import { describe, expect, it } from "vitest"
import { Feature } from "geojson"
describe("OverlapFunc", () => {
it("should give doors on the edge", () => {

View file

@ -652,10 +652,12 @@ describe("RelationSplitHandler", () => {
"no-theme",
downloader
)
const changeDescription = await splitter.CreateChangeDescriptions(new Changes({
dryRun: new ImmutableStore(false),
osmConnection: new OsmConnection()
}))
const changeDescription = await splitter.CreateChangeDescriptions(
new Changes({
dryRun: new ImmutableStore(false),
osmConnection: new OsmConnection(),
})
)
const allIds = changeDescription[0].changes["members"].map((m) => m.ref).join(",")
const expected = "687866206,295132739,-1,690497698"
// "didn't find the expected order of ids in the relation to test"
@ -707,10 +709,12 @@ describe("RelationSplitHandler", () => {
"no-theme",
downloader
)
const changeDescription = await splitter.CreateChangeDescriptions(new Changes({
dryRun: new ImmutableStore(false),
osmConnection: new OsmConnection()
}))
const changeDescription = await splitter.CreateChangeDescriptions(
new Changes({
dryRun: new ImmutableStore(false),
osmConnection: new OsmConnection(),
})
)
const allIds = changeDescription[0].changes["members"]
.map((m) => m.type + "/" + m.ref + "-->" + m.role)
.join(",")

View file

@ -6,7 +6,7 @@ import { describe, expect, it } from "vitest"
import { OsmConnection } from "../../../../Logic/Osm/OsmConnection"
import { ImmutableStore } from "../../../../Logic/UIEventSource"
import { Changes } from "../../../../Logic/Osm/Changes"
import FullNodeDatabaseSource from "../../../../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource";
import FullNodeDatabaseSource from "../../../../Logic/FeatureSource/TiledFeatureSource/FullNodeDatabaseSource"
describe("ReplaceGeometryAction", () => {
const grbStripped = {
@ -886,7 +886,7 @@ describe("ReplaceGeometryAction", () => {
fullNodeDatabase.handleOsmJson(data, 0, 0, 0)
const changes = new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection()
osmConnection: new OsmConnection(),
})
const osmConnection = new OsmConnection({
dryRun: new ImmutableStore(true),

View file

@ -2,8 +2,8 @@ import { Utils } from "../../../../Utils"
import SplitAction from "../../../../Logic/Osm/Actions/SplitAction"
import { Changes } from "../../../../Logic/Osm/Changes"
import { describe, expect, it } from "vitest"
import {OsmConnection} from "../../../../Logic/Osm/OsmConnection";
import {ImmutableStore} from "../../../../Logic/UIEventSource";
import { OsmConnection } from "../../../../Logic/Osm/OsmConnection"
import { ImmutableStore } from "../../../../Logic/UIEventSource"
describe("SplitAction", () => {
{
@ -2689,10 +2689,12 @@ describe("SplitAction", () => {
const splitter = new SplitAction(id, [splitPoint], {
theme: "test",
})
const changeDescription = await splitter.CreateChangeDescriptions(new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection()
}))
const changeDescription = await splitter.CreateChangeDescriptions(
new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection(),
})
)
expect(changeDescription[0].type).toBe("node")
expect(changeDescription[0].id).toBe(-1)
@ -2717,10 +2719,12 @@ describe("SplitAction", () => {
const splitter = new SplitAction(id, [splitPoint], {
theme: "test",
})
const changeDescription = await splitter.CreateChangeDescriptions(new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection()
}))
const changeDescription = await splitter.CreateChangeDescriptions(
new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection(),
})
)
expect(changeDescription.length).toBe(2)
expect(changeDescription[0].type).toBe("way")
@ -2737,10 +2741,12 @@ describe("SplitAction", () => {
const splitter = new SplitAction(id, [splitPoint], {
theme: "test",
})
const changeDescription = await splitter.CreateChangeDescriptions(new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection()
}))
const changeDescription = await splitter.CreateChangeDescriptions(
new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection(),
})
)
// Should be a new node
expect(changeDescription[0].type).toBe("node")
@ -2753,10 +2759,12 @@ describe("SplitAction", () => {
const splitAction = new SplitAction("way/941079939", [splitPointAroundP3], {
theme: "test",
})
const changes = await splitAction.Perform(new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection()
}))
const changes = await splitAction.Perform(
new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection(),
})
)
console.log(changes)
// 8715440368 is the expected point of the split
@ -2794,10 +2802,12 @@ describe("SplitAction", () => {
{ theme: "test" },
1
)
const changes = await splitAction.Perform(new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection()
}))
const changes = await splitAction.Perform(
new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection(),
})
)
// THe first change is the creation of the new node
expect(changes[0].type).toEqual("node")

View file

@ -1,8 +1,8 @@
import { ChangeDescription } from "../../../Logic/Osm/Actions/ChangeDescription"
import { Changes } from "../../../Logic/Osm/Changes"
import { expect, it } from "vitest"
import {ImmutableStore} from "../../../Logic/UIEventSource";
import {OsmConnection} from "../../../Logic/Osm/OsmConnection";
import { ImmutableStore } from "../../../Logic/UIEventSource"
import { OsmConnection } from "../../../Logic/Osm/OsmConnection"
it("Generate preXML from changeDescriptions", () => {
const changeDescrs: ChangeDescription[] = [
@ -31,7 +31,7 @@ it("Generate preXML from changeDescriptions", () => {
]
const c = new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection()
osmConnection: new OsmConnection(),
})
const descr = c.CreateChangesetObjects(changeDescrs, [])
expect(descr.modifiedObjects).toHaveLength(0)

View file

@ -1,6 +1,6 @@
import { Utils } from "../../../Utils"
import { ChangesetHandler, ChangesetTag } from "../../../Logic/Osm/ChangesetHandler"
import {ImmutableStore, UIEventSource} from "../../../Logic/UIEventSource"
import { ImmutableStore, UIEventSource } from "../../../Logic/UIEventSource"
import { OsmConnection } from "../../../Logic/Osm/OsmConnection"
import { Changes } from "../../../Logic/Osm/Changes"
import { describe, expect, it } from "vitest"
@ -18,7 +18,7 @@ describe("ChangesetHanlder", () => {
elstorage(),
new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection()
osmConnection: new OsmConnection(),
})
)
@ -80,7 +80,7 @@ describe("ChangesetHanlder", () => {
elstorage(),
new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection()
osmConnection: new OsmConnection(),
})
)
const oldChangesetMeta = {
@ -141,7 +141,7 @@ describe("ChangesetHanlder", () => {
elstorage(),
new Changes({
dryRun: new ImmutableStore(true),
osmConnection: new OsmConnection()
osmConnection: new OsmConnection(),
})
)
const oldChangesetMeta = {

View file

@ -92,7 +92,9 @@ describe("OsmObject", () => {
"https://www.openstreetmap.org/api/0.6/relation/5759328/full",
JSON.parse(readFileSync("./test/data/relation_5759328.json", { encoding: "utf-8" }))
)
const r = await new OsmObjectDownloader().DownloadObjectAsync("relation/5759328").then((x) => x)
const r = await new OsmObjectDownloader()
.DownloadObjectAsync("relation/5759328")
.then((x) => x)
const geojson = r.asGeoJson()
expect(geojson.geometry.type).toBe("MultiPolygon")
})

View file

@ -1,6 +1,6 @@
import {TagUtils} from "../../../Logic/Tags/TagUtils"
import {equal} from "assert"
import {describe, expect, it} from "vitest"
import { TagUtils } from "../../../Logic/Tags/TagUtils"
import { equal } from "assert"
import { describe, expect, it } from "vitest"
describe("TagUtils", () => {
describe("ParseTag", () => {
@ -47,9 +47,9 @@ describe("TagUtils", () => {
})
describe("regextag", () => {
it("should match tags", () => {
const t = TagUtils.Tag( "_tags~(^|.*;)leisure=picnic_table($|;.*)")
const t = TagUtils.Tag("_tags~(^|.*;)leisure=picnic_table($|;.*)")
const properties = {
_tags: 'leisure=picnic_table'
_tags: "leisure=picnic_table",
}
expect(t.matchesProperties(properties)).toBe(true)
})

View file

@ -1,12 +1,14 @@
import {LayerConfigJson} from "../../../../Models/ThemeConfig/Json/LayerConfigJson"
import {TagRenderingConfigJson} from "../../../../Models/ThemeConfig/Json/TagRenderingConfigJson"
import { LayerConfigJson } from "../../../../Models/ThemeConfig/Json/LayerConfigJson"
import { TagRenderingConfigJson } from "../../../../Models/ThemeConfig/Json/TagRenderingConfigJson"
import LineRenderingConfigJson from "../../../../Models/ThemeConfig/Json/LineRenderingConfigJson"
import {ExpandRewrite, PrepareLayer, RewriteSpecial,} from "../../../../Models/ThemeConfig/Conversion/PrepareLayer"
import {
QuestionableTagRenderingConfigJson
} from "../../../../Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson"
ExpandRewrite,
PrepareLayer,
RewriteSpecial,
} from "../../../../Models/ThemeConfig/Conversion/PrepareLayer"
import { QuestionableTagRenderingConfigJson } from "../../../../Models/ThemeConfig/Json/QuestionableTagRenderingConfigJson"
import RewritableConfigJson from "../../../../Models/ThemeConfig/Json/RewritableConfigJson"
import {describe, expect, it} from "vitest"
import { describe, expect, it } from "vitest"
describe("ExpandRewrite", () => {
it("should not allow overlapping keys", () => {
@ -65,7 +67,7 @@ describe("PrepareLayer", () => {
const expected = {
id: "testlayer",
source: {osmTags: "key=value"},
source: { osmTags: "key=value" },
mapRendering: [
{
color: {
@ -100,7 +102,7 @@ describe("PrepareLayer", () => {
offset: 6,
},
],
titleIcons: [{render: "icons.defaults", id: "iconsdefaults"}],
titleIcons: [{ render: "icons.defaults", id: "iconsdefaults" }],
}
expect(result).toEqual(expected)

File diff suppressed because it is too large Load diff