UNPKG

copybase

Version:

Copy or backup databases quickly

32 lines (31 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const util_1 = require("./util"); describe("test parseDatabaseUri", () => { test("mongodb", () => { expect((0, util_1.parseDatabaseUri)("mongodb://root:password@localhost:27017/demo")).toMatchObject({ hostname: "localhost", password: "password", protocol: "mongodb", username: "root", database: "demo", }); expect((0, util_1.parseDatabaseUri)("mongodb+srv://root:password@localhost:27017/demo?retryWrites=true&w=majority")).toMatchObject({ hostname: "localhost", password: "password", protocol: "mongodb+srv", username: "root", database: "demo", params: { retryWrites: "true", w: "majority" }, }); }); test("postgresql", () => { expect((0, util_1.parseDatabaseUri)("postgresql://root:password@localhost:54322/demo")).toMatchObject({ hostname: "localhost", password: "password", protocol: "postgresql", database: "demo", username: "root", }); }); });