Fix: fix tests with some refactoring

This commit is contained in:
Pieter Vander Vennet 2024-09-27 03:04:05 +02:00
parent f132963485
commit 0b992e75a4
7 changed files with 64 additions and 401 deletions

View file

@ -1,14 +1,9 @@
import { Utils } from "../../../../src/Utils"
import { OsmRelation } from "../../../../src/Logic/Osm/OsmObject"
import {
InPlaceReplacedmentRTSH,
TurnRestrictionRSH,
} from "../../../../src/Logic/Osm/Actions/RelationSplitHandler"
import { InPlaceReplacedmentRTSH, TurnRestrictionRSH } from "../../../../src/Logic/Osm/Actions/RelationSplitHandler"
import { Changes } from "../../../../src/Logic/Osm/Changes"
import { describe, expect, it } from "vitest"
import OsmObjectDownloader from "../../../../src/Logic/Osm/OsmObjectDownloader"
import { ImmutableStore } from "../../../../src/Logic/UIEventSource"
import { OsmConnection } from "../../../../src/Logic/Osm/OsmConnection"
describe("RelationSplitHandler", () => {
Utils.injectJsonDownloadForTests("https://api.openstreetmap.org/api/0.6/node/1124134958/ways", {
@ -653,10 +648,7 @@ describe("RelationSplitHandler", () => {
downloader
)
const changeDescription = await splitter.CreateChangeDescriptions(
new Changes({
dryRun: new ImmutableStore(false),
osmConnection: new OsmConnection(),
})
Changes.createTestObject()
)
const allIds = changeDescription[0].changes["members"].map((m) => m.ref).join(",")
const expected = "687866206,295132739,-1,690497698"
@ -710,10 +702,7 @@ describe("RelationSplitHandler", () => {
downloader
)
const changeDescription = await splitter.CreateChangeDescriptions(
new Changes({
dryRun: new ImmutableStore(false),
osmConnection: new OsmConnection(),
})
Changes.createTestObject()
)
const allIds = changeDescription[0].changes["members"]
.map((m) => m.type + "/" + m.ref + "-->" + m.role)
@ -734,10 +723,7 @@ describe("RelationSplitHandler", () => {
downloader
)
const changesReverse = await splitterReverse.CreateChangeDescriptions(
new Changes({
dryRun: new ImmutableStore(false),
osmConnection: new OsmConnection(),
})
Changes.createTestObject()
)
expect(changesReverse.length).toEqual(0)
})