refactoring: slight cleanup of tests

This commit is contained in:
Pieter Vander Vennet 2023-04-07 03:54:11 +02:00
parent 2e9b1016de
commit f8d34648a0
28 changed files with 252 additions and 353 deletions

View file

@ -82,7 +82,7 @@ export default class DeleteAction extends OsmChangeAction {
return await new ChangeTagAction(this._id, this._softDeletionTags, osmObject.tags, {
...this.meta,
changeType: "soft-delete",
}).CreateChangeDescriptions(changes)
}).CreateChangeDescriptions()
}
}
}

View file

@ -29,7 +29,7 @@ export class ChangesetHandler {
constructor(
dryRun: UIEventSource<boolean>,
osmConnection: OsmConnection,
allElements: { addAlias: (id0: String, id1: string) => void },
allElements: { addAlias: (id0: string, id1: string) => void },
changes: Changes
) {
this.osmConnection = osmConnection
@ -68,9 +68,9 @@ export class ChangesetHandler {
* The key is changed _in place_; true will be returned if a change has been applied
* @param extraMetaTags
* @param rewriteIds
* @private
* @public for testing purposes
*/
private static rewriteMetaTags(extraMetaTags: ChangesetTag[], rewriteIds: Map<string, string>) {
public static rewriteMetaTags(extraMetaTags: ChangesetTag[], rewriteIds: Map<string, string>) {
let hasChange = false
for (const tag of extraMetaTags) {
const match = tag.key.match(/^([a-zA-Z0-9_]+):(node\/-[0-9])$/)
@ -185,8 +185,10 @@ export class ChangesetHandler {
* @param extraMetaTags: new changeset tags to add/fuse with this changeset
* @param rewriteIds: the mapping of ids
* @param oldChangesetMeta: the metadata-object of the already existing changeset
*
* @public for testing purposes
*/
private RewriteTagsOf(
public RewriteTagsOf(
extraMetaTags: ChangesetTag[],
rewriteIds: Map<string, string>,
oldChangesetMeta: {
@ -305,6 +307,7 @@ export class ChangesetHandler {
return new Map<string, string>(mappings)
}
// noinspection JSUnusedLocalSymbols
private async CloseChangeset(changesetId: number = undefined): Promise<void> {
if (changesetId === undefined) {
return

View file

@ -59,7 +59,7 @@ export class OsmConnection {
oauth_secret: string
url: string
}
private readonly _dryRun: UIEventSource<boolean>
private readonly _dryRun: Store<boolean>
private fakeUser: boolean
private _onLoggedIn: ((userDetails: UserDetails) => void)[] = []
private readonly _iframeMode: Boolean | boolean
@ -67,7 +67,7 @@ export class OsmConnection {
private isChecking = false
constructor(options?: {
dryRun?: UIEventSource<boolean>
dryRun?: Store<boolean>
fakeUser?: false | boolean
oauth_token?: UIEventSource<string>
// Used to keep multiple changesets open and to write to the correct changeset