2023-05-05 05:29:08 +00:00
|
|
|
// @ts-check
|
|
|
|
|
2023-08-18 05:00:40 +00:00
|
|
|
const fs = require("fs")
|
2023-05-05 05:29:08 +00:00
|
|
|
const sqlite = require("better-sqlite3")
|
|
|
|
const HeatSync = require("heatsync")
|
|
|
|
|
|
|
|
const config = require("../config")
|
|
|
|
const passthrough = require("../passthrough")
|
2023-08-18 05:00:40 +00:00
|
|
|
const db = new sqlite(":memory:")
|
|
|
|
|
2023-09-12 09:37:36 +00:00
|
|
|
const reg = require("../matrix/read-registration")
|
|
|
|
reg.ooye.server_origin = "https://matrix.cadence.moe" // so that tests will pass even when hard-coded
|
|
|
|
|
2023-08-28 05:32:55 +00:00
|
|
|
db.exec(fs.readFileSync("db/ooye-schema.sql", "utf8"))
|
|
|
|
db.exec(fs.readFileSync("db/ooye-test-data.sql", "utf8"))
|
2023-05-05 05:29:08 +00:00
|
|
|
|
2023-05-08 05:22:20 +00:00
|
|
|
const sync = new HeatSync({watchFS: false})
|
2023-05-05 05:29:08 +00:00
|
|
|
|
|
|
|
Object.assign(passthrough, { config, sync, db })
|
|
|
|
|
2023-09-14 00:32:27 +00:00
|
|
|
const orm = sync.require("../db/orm")
|
|
|
|
passthrough.from = orm.from
|
|
|
|
passthrough.select = orm.select
|
|
|
|
|
2023-08-18 05:00:40 +00:00
|
|
|
const file = sync.require("../matrix/file")
|
|
|
|
file._actuallyUploadDiscordFileToMxc = function(url, res) { throw new Error(`Not allowed to upload files during testing.\nURL: ${url}`) }
|
|
|
|
|
2023-05-10 05:40:31 +00:00
|
|
|
require("../matrix/kstate.test")
|
|
|
|
require("../matrix/api.test")
|
2023-05-09 03:29:46 +00:00
|
|
|
require("../matrix/read-registration.test")
|
2023-08-24 05:23:32 +00:00
|
|
|
require("../matrix/txnid.test")
|
2023-05-12 05:35:37 +00:00
|
|
|
require("../d2m/converters/message-to-event.test")
|
2023-08-19 10:54:23 +00:00
|
|
|
require("../d2m/converters/message-to-event.embeds.test")
|
2023-08-16 05:03:05 +00:00
|
|
|
require("../d2m/converters/edit-to-changes.test")
|
2023-08-21 11:31:40 +00:00
|
|
|
require("../d2m/converters/thread-to-announcement.test")
|
2023-05-05 13:25:15 +00:00
|
|
|
require("../d2m/actions/create-room.test")
|
2023-05-08 12:58:46 +00:00
|
|
|
require("../d2m/converters/user-to-mxid.test")
|
2023-06-30 03:15:34 +00:00
|
|
|
require("../d2m/actions/register-user.test")
|
2023-07-02 13:06:05 +00:00
|
|
|
require("../m2d/converters/event-to-message.test")
|
2023-07-03 12:39:42 +00:00
|
|
|
require("../m2d/converters/utils.test")
|