1
0
Fork 0
mirror of synced 2024-06-16 09:25:12 +12:00

Add tests for updating and reverting client library version

This commit is contained in:
Andrew Kingston 2021-07-08 13:20:52 +01:00
parent 6716bf2da1
commit 567d8577ba
2 changed files with 32 additions and 4 deletions

View file

@ -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 = {

View file

@ -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()