Repository: typeorm/typeorm
File: test/functional/multi-database/multi-database-basic-functionality/multi-database-basic-functionality.ts (TypeScript)

Code before:
import "../../../utils/test-setup"
import { expect } from "chai"
import { DataSource } from "../../../../src/data-source/DataSource"
import {
    closeTestingConnections,
    createTestingConnections,
    reloadTestingDatabases,
} from "../../../utils/test-utils"
import { Answer } from "./entity/Answer"
import { Category } from "./entity/Category"
import { Post } from "./entity/Post"
import { User } from "./entity/User"
import { filepathToName } from "../../../../src/util/PathUtils"
import { rimraf } from "rimraf"
import path from "path"
import fs from "fs/promises"
import appRoot from "app-root-path"

const VALID_NAME_REGEX = /^(?!sqlite_).{1,63}$/

describe("multi-database > basic-functionality", () => {
    describe("filepathToName()", () => {
        if (process.platform !== "win32") return
        it(`produces deterministic, unique, and valid table names for relative paths; leaves absolute paths unchanged`, () => {
            const testMap = [
                ["FILENAME.db", "filename.db"],
                ["..\\FILENAME.db", "../filename.db"],
                [".\\FILENAME.db", "./filename.db"],
                [
                    "..\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\FILENAME.db",
                    "../longpathdir/longpathdir/longpathdir/longpathdir/longpathdir/longpathdir/longpathdir/filename.db",
                ],
                ["C:\\dirFILENAME.db", "C:\\dirFILENAME.db"],
                ["/dir/filename.db", "/dir/filename.db"],
            ]
            for (const [winOs, otherOs] of testMap) {
                const winOsRes = filepathToName(winOs)
                const otherOsRes = filepathToName(otherOs)
                expect(winOsRes).to.equal(otherOsRes)
                expect(winOsRes).to.match(
                    VALID_NAME_REGEX,
                    `'${winOs}' is invalid table name`,
                )
            }
        })
    })

    describe("multiple databases", () => {

Review comment (suggestion):
These tests shouldn't be skipped on non-windows platforms. On darwin/linux we still want to assert that relative paths are normalized when used as table names.

Code after:
import "../../../utils/test-setup"
import { expect } from "chai"
import { DataSource } from "../../../../src/data-source/DataSource"
import {
    closeTestingConnections,
    createTestingConnections,
    reloadTestingDatabases,
    withPlatform,
} from "../../../utils/test-utils"
import { Answer } from "./entity/Answer"
import { Category } from "./entity/Category"
import { Post } from "./entity/Post"
import { User } from "./entity/User"
import { filepathToName } from "../../../../src/util/PathUtils"
import { rimraf } from "rimraf"
import path from "path"
import fs from "fs/promises"
import appRoot from "app-root-path"

const VALID_NAME_REGEX = /^(?!sqlite_).{1,63}$/

describe("multi-database > basic-functionality", () => {
    describe("filepathToName()", () => {
        for (const platform of [`darwin`, `win32`]) {
            it(`[${platform}] produces deterministic, unique, and valid table names for relative paths; leaves absolute paths unchanged`, () => {
                const testMap = [
                    ["FILENAME.db", "filename.db"],
                    ["..\\FILENAME.db", platform === 'win32' ? "../filename.db" : "..\\filename.db"],
                    [".\\FILENAME.db", platform === 'win32' ? "./filename.db" : ".\\filename.db"],
                    [
                        "..\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\FILENAME.db",
                        platform === 'win32'
                            ? "../longpathdir/longpathdir/longpathdir/longpathdir/longpathdir/longpathdir/longpathdir/filename.db"
                            : "..\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\longpathdir\\filename.db",
                    ],
                    ["C:\\dirFILENAME.db", "C:\\dirFILENAME.db"],
                    ["/dir/filename.db", "/dir/filename.db"],
                ]
                for (const [winOs, otherOs] of testMap) {
                    const winOsRes = withPlatform(platform, () =>
                        filepathToName(winOs),
                    )
                    const otherOsRes = withPlatform(platform, () =>
                        filepathToName(otherOs),
                    )
                    expect(winOsRes).to.equal(otherOsRes)
                    expect(winOsRes).to.match(
                        VALID_NAME_REGEX,