hunk.code_window: import {createConnection} from "../../../src/index";
   import rimraf from "rimraf";
   import {dirname} from "path";
   import {Connection} from "../../../src/connection/Connection";
   describe("github issues > #799 sqlite: 'database' path should be created", () => {
       let connection: Connection;
       const path = `${__dirname}/tmp/sqlitedb.db`;
  
hunk.labels: keep keep keep add keep keep keep keep keep
hunk.after_edit: import {getTypeOrmConfig} from "../../utils/test-utils";
  
hunk.file_path: test/github-issues/799/issue-799.ts
hunk.type: add
file: import "reflect-metadata";
  import * as assert from "assert";
  import {createConnection, getConnectionOptions} from "../../../src/index";
  import {Connection} from "../../../src/connection/Connection";
  import {getTypeOrmConfig} from "../../utils/test-utils";
  
  describe("github issues > #798 sqlite: 'database' path in ormconfig.json is not relative", () => {
      let connection: Connection;
      const oldCwd = process.cwd();
  
      before(function () {
          process.chdir("..");
      });
  
      after(function () {
          process.chdir(oldCwd);
      });
  
      afterEach(() => {
          if (connection && connection.isConnected) {
              connection.close();
          }
      });
  
      it("should find the sqlite database if the cwd is changed", async function () {
          // run test only if sqlite3 is enabled in ormconfig
          const isEnabled = getTypeOrmConfig().some(conf => conf.type === "sqlite" && conf.skip === false)
          if (!isEnabled) return
  
          const options = await getConnectionOptions("sqlite");
          connection = await createConnection(options);
  
          assert.strictEqual(connection.isConnected, true);
      });
  
      it("should find the sqlite database if the cwd is changed for better-sqlite3", async function () {
          // run test only if sqlite3 is enabled in ormconfig
          const isEnabled = getTypeOrmConfig().some(conf => conf.type === "better-sqlite3" && conf.skip === false)
          if (!isEnabled) return
  
          const options = await getConnectionOptions("better-sqlite3");
          connection = await createConnection(options);
  
          assert.strictEqual(connection.isConnected, true);
      });
  
  });
  