Remove unused test.
This commit is contained in:
parent
80fbaa1599
commit
ff4f8f1d66
|
@ -1,63 +0,0 @@
|
||||||
const migrateFn = jest.fn()
|
|
||||||
|
|
||||||
import { TestConfiguration } from "../../../../tests"
|
|
||||||
|
|
||||||
jest.mock("../../../../migrations", () => {
|
|
||||||
return {
|
|
||||||
...jest.requireActual("../../../../migrations"),
|
|
||||||
migrate: migrateFn,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("/api/system/migrations", () => {
|
|
||||||
const config = new TestConfiguration()
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
|
||||||
await config.beforeAll()
|
|
||||||
})
|
|
||||||
|
|
||||||
afterAll(async () => {
|
|
||||||
await config.afterAll()
|
|
||||||
})
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
jest.clearAllMocks()
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("POST /api/system/migrations/run", () => {
|
|
||||||
it("fails with no internal api key", async () => {
|
|
||||||
const res = await config.api.migrations.runMigrations({
|
|
||||||
headers: {},
|
|
||||||
status: 403,
|
|
||||||
})
|
|
||||||
expect(res.body).toEqual({ message: "Unauthorized", status: 403 })
|
|
||||||
expect(migrateFn).toHaveBeenCalledTimes(0)
|
|
||||||
})
|
|
||||||
|
|
||||||
it("runs migrations", async () => {
|
|
||||||
const res = await config.api.migrations.runMigrations()
|
|
||||||
expect(res.body.message).toBeDefined()
|
|
||||||
expect(migrateFn).toHaveBeenCalledTimes(1)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("DELETE /api/system/migrations/definitions", () => {
|
|
||||||
it("fails with no internal api key", async () => {
|
|
||||||
const res = await config.api.migrations.getMigrationDefinitions({
|
|
||||||
headers: {},
|
|
||||||
status: 403,
|
|
||||||
})
|
|
||||||
expect(res.body).toEqual({ message: "Unauthorized", status: 403 })
|
|
||||||
})
|
|
||||||
|
|
||||||
it("returns definitions", async () => {
|
|
||||||
const res = await config.api.migrations.getMigrationDefinitions()
|
|
||||||
expect(res.body).toEqual([
|
|
||||||
{
|
|
||||||
name: "global_info_sync_users",
|
|
||||||
type: "global",
|
|
||||||
},
|
|
||||||
])
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
|
@ -6,7 +6,6 @@ import { EmailAPI } from "./email"
|
||||||
import { SelfAPI } from "./self"
|
import { SelfAPI } from "./self"
|
||||||
import { UserAPI } from "./users"
|
import { UserAPI } from "./users"
|
||||||
import { EnvironmentAPI } from "./environment"
|
import { EnvironmentAPI } from "./environment"
|
||||||
import { MigrationAPI } from "./migrations"
|
|
||||||
import { StatusAPI } from "./status"
|
import { StatusAPI } from "./status"
|
||||||
import { RestoreAPI } from "./restore"
|
import { RestoreAPI } from "./restore"
|
||||||
import { TenantAPI } from "./tenants"
|
import { TenantAPI } from "./tenants"
|
||||||
|
@ -26,7 +25,6 @@ export default class API {
|
||||||
self: SelfAPI
|
self: SelfAPI
|
||||||
users: UserAPI
|
users: UserAPI
|
||||||
environment: EnvironmentAPI
|
environment: EnvironmentAPI
|
||||||
migrations: MigrationAPI
|
|
||||||
status: StatusAPI
|
status: StatusAPI
|
||||||
restore: RestoreAPI
|
restore: RestoreAPI
|
||||||
tenants: TenantAPI
|
tenants: TenantAPI
|
||||||
|
@ -46,7 +44,6 @@ export default class API {
|
||||||
this.self = new SelfAPI(config)
|
this.self = new SelfAPI(config)
|
||||||
this.users = new UserAPI(config)
|
this.users = new UserAPI(config)
|
||||||
this.environment = new EnvironmentAPI(config)
|
this.environment = new EnvironmentAPI(config)
|
||||||
this.migrations = new MigrationAPI(config)
|
|
||||||
this.status = new StatusAPI(config)
|
this.status = new StatusAPI(config)
|
||||||
this.restore = new RestoreAPI(config)
|
this.restore = new RestoreAPI(config)
|
||||||
this.tenants = new TenantAPI(config)
|
this.tenants = new TenantAPI(config)
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
import { TestAPI, TestAPIOpts } from "./base"
|
|
||||||
|
|
||||||
export class MigrationAPI extends TestAPI {
|
|
||||||
runMigrations = (opts?: TestAPIOpts) => {
|
|
||||||
return this.request
|
|
||||||
.post(`/api/system/migrations/run`)
|
|
||||||
.set(opts?.headers ? opts.headers : this.config.internalAPIHeaders())
|
|
||||||
.expect(opts?.status ? opts.status : 200)
|
|
||||||
}
|
|
||||||
|
|
||||||
getMigrationDefinitions = (opts?: TestAPIOpts) => {
|
|
||||||
return this.request
|
|
||||||
.get(`/api/system/migrations/definitions`)
|
|
||||||
.set(opts?.headers ? opts.headers : this.config.internalAPIHeaders())
|
|
||||||
.expect(opts?.status ? opts.status : 200)
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue