From 27334158c2bf73022dc3b8d0182332093decd2ad Mon Sep 17 00:00:00 2001 From: Abdul Ahad Date: Sun, 13 Oct 2024 23:59:16 +0200 Subject: [PATCH] test: update button --- .../__tests__/UpdateChecksSpec.js | 57 ++++++++++++++++--- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/client/src/plugins/update-checks/__tests__/UpdateChecksSpec.js b/client/src/plugins/update-checks/__tests__/UpdateChecksSpec.js index 841aea55b4..aeaee0737e 100644 --- a/client/src/plugins/update-checks/__tests__/UpdateChecksSpec.js +++ b/client/src/plugins/update-checks/__tests__/UpdateChecksSpec.js @@ -402,19 +402,20 @@ describe('', function() { // given const { - component + component, + instance } = createComponent(); - mockServerResponse(component, { - update: { - latestVersion: 'v3.7.0', - downloadURL: 'test-download-url', - releases: [] - } - }); + const update = { + latestVersion: 'v3.7.0', + downloadURL: 'test-download-url', + releases: [] + }; + + mockServerResponse(component, { update }); // when - await tick(component); + await instance.checkLatestVersion(update, false); // then expect(component.state().showModal).to.be.true; @@ -614,6 +615,44 @@ describe('', function() { expect(logSpy).to.not.have.been.called; }); + it('should show button', async function() { + + // given + const { + component + } = createComponent(); + + mockServerResponse(component, { + update: { + latestVersion: 'v3.7.0', + downloadURL: 'test-download-url', + releases: [] + } + }); + + // when + await tick(component); + + // then + expect(component.state().updateAvailable).to.be.true; + }); + + it('should not show button if no update', async function() { + + // given + const { + component + } = createComponent(); + + mockServerResponse(component, {}); + + // when + await tick(component); + + // then + expect(component.state().updateAvailable).to.be.false; + }); + }); });