2021-05-06 21:54:01 +12:00
|
|
|
const setup = require("./utilities")
|
|
|
|
|
|
|
|
// mock the email system
|
|
|
|
jest.mock("nodemailer")
|
|
|
|
const nodemailer = require("nodemailer")
|
|
|
|
nodemailer.createTransport.mockReturnValue({
|
|
|
|
verify: jest.fn()
|
|
|
|
})
|
|
|
|
|
2021-08-05 20:59:08 +12:00
|
|
|
describe("/api/global/configs/checklist", () => {
|
2021-05-06 21:54:01 +12:00
|
|
|
let request = setup.getRequest()
|
|
|
|
let config = setup.getConfig()
|
|
|
|
|
|
|
|
beforeAll(async () => {
|
2021-08-05 20:59:08 +12:00
|
|
|
await config.init()
|
2021-05-06 21:54:01 +12:00
|
|
|
})
|
|
|
|
|
|
|
|
afterAll(setup.afterAll)
|
|
|
|
|
|
|
|
it("should return the correct checklist status based on the state of the budibase installation", async () => {
|
|
|
|
await config.saveSmtpConfig()
|
|
|
|
|
|
|
|
const res = await request
|
2021-08-05 20:59:08 +12:00
|
|
|
.get(`/api/global/configs/checklist`)
|
2021-05-06 21:54:01 +12:00
|
|
|
.set(config.defaultHeaders())
|
|
|
|
.expect("Content-Type", /json/)
|
|
|
|
.expect(200)
|
|
|
|
|
|
|
|
const checklist = res.body
|
|
|
|
|
|
|
|
expect(checklist.apps).toBe(0)
|
|
|
|
expect(checklist.smtp).toBe(true)
|
|
|
|
expect(checklist.adminUser).toBe(true)
|
|
|
|
})
|
|
|
|
})
|