Add tests for updating and reverting client library version
This commit is contained in:
parent
0ce553eaf2
commit
959405332d
|
@ -248,8 +248,10 @@ exports.updateClient = async function (ctx) {
|
|||
const currentVersion = application.version
|
||||
|
||||
// Update client library and manifest
|
||||
await backupClientLibrary(ctx.params.appId)
|
||||
await updateClientLibrary(ctx.params.appId)
|
||||
if (!env.isTest()) {
|
||||
await backupClientLibrary(ctx.params.appId)
|
||||
await updateClientLibrary(ctx.params.appId)
|
||||
}
|
||||
|
||||
// Update versions in app package
|
||||
const appPackageUpdates = {
|
||||
|
@ -270,7 +272,9 @@ exports.revertClient = async function (ctx) {
|
|||
}
|
||||
|
||||
// Update client library and manifest
|
||||
await revertClientLibrary(ctx.params.appId)
|
||||
if (!env.isTest()) {
|
||||
await revertClientLibrary(ctx.params.appId)
|
||||
}
|
||||
|
||||
// Update versions in app package
|
||||
const appPackageUpdates = {
|
||||
|
|
|
@ -94,7 +94,7 @@ describe("/applications", () => {
|
|||
})
|
||||
|
||||
describe("update", () => {
|
||||
it("should be able to fetch the app package", async () => {
|
||||
it("should be able to update the app package", async () => {
|
||||
const res = await request
|
||||
.put(`/api/applications/${config.getAppId()}`)
|
||||
.send({
|
||||
|
@ -107,6 +107,30 @@ describe("/applications", () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe("manage client library version", () => {
|
||||
it("should be able to update the app client library version", async () => {
|
||||
console.log(config.getAppId())
|
||||
await request
|
||||
.post(`/api/applications/${config.getAppId()}/client/update`)
|
||||
.set(config.defaultHeaders())
|
||||
.expect("Content-Type", /json/)
|
||||
.expect(200)
|
||||
})
|
||||
it("should be able to revert the app client library version", async () => {
|
||||
// We need to first update the version so that we can then revert
|
||||
await request
|
||||
.post(`/api/applications/${config.getAppId()}/client/update`)
|
||||
.set(config.defaultHeaders())
|
||||
.expect("Content-Type", /json/)
|
||||
.expect(200)
|
||||
await request
|
||||
.post(`/api/applications/${config.getAppId()}/client/revert`)
|
||||
.set(config.defaultHeaders())
|
||||
.expect("Content-Type", /json/)
|
||||
.expect(200)
|
||||
})
|
||||
})
|
||||
|
||||
describe("edited at", () => {
|
||||
it("middleware should set edited at", async () => {
|
||||
const headers = config.defaultHeaders()
|
||||
|
|
Loading…
Reference in New Issue