Skip to content

Commit

Permalink
test: update button
Browse files Browse the repository at this point in the history
  • Loading branch information
abdul99ahad committed Oct 28, 2024
1 parent bcebaff commit 1fdbb68
Showing 1 changed file with 48 additions and 9 deletions.
57 changes: 48 additions & 9 deletions client/src/plugins/update-checks/__tests__/UpdateChecksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,19 +402,20 @@ describe('<UpdateChecks>', 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;
Expand Down Expand Up @@ -614,6 +615,44 @@ describe('<UpdateChecks>', function() {
expect(logSpy).to.not.have.been.called;
});

it('should show <update-available> 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 <update-available> button if no update', async function() {

// given
const {
component
} = createComponent();

mockServerResponse(component, {});

// when
await tick(component);

// then
expect(component.state().updateAvailable).to.be.false;
});

});

});
Expand Down

0 comments on commit 1fdbb68

Please sign in to comment.