2023-11-05 00:59:55 +01:00
|
|
|
/* import { afterAll, beforeAll, describe, expect, it } from "bun:test";
|
2023-09-29 01:58:05 +02:00
|
|
|
import { AppDataSource } from "~database/datasource";
|
|
|
|
|
import { Instance } from "~database/entities/Instance";
|
|
|
|
|
|
|
|
|
|
let instance: Instance;
|
|
|
|
|
|
|
|
|
|
beforeAll(async () => {
|
|
|
|
|
if (!AppDataSource.isInitialized) await AppDataSource.initialize();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe("Instance", () => {
|
|
|
|
|
it("should add an instance to the database if it doesn't already exist", async () => {
|
|
|
|
|
const url = "https://mastodon.social";
|
|
|
|
|
instance = await Instance.addIfNotExists(url);
|
|
|
|
|
expect(instance.base_url).toBe("mastodon.social");
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
afterAll(async () => {
|
|
|
|
|
await instance.remove();
|
2023-10-19 21:53:59 +02:00
|
|
|
|
|
|
|
|
await AppDataSource.destroy();
|
2023-09-29 01:58:05 +02:00
|
|
|
});
|
2023-11-05 00:59:55 +01:00
|
|
|
*/
|