Skip to content

Commit

Permalink
tests: adds more unit tests for syncCloudData method
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-a-pelegrino authored and ggazzo committed Nov 11, 2024
1 parent 3aa7cce commit f416564
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('SyncCloudData', () => {
mockedFetchWorkspaceSyncPayload.reset();
});

it('should save cloudSyncAnnouncement on Cloud_Sync_Announcement_Payload when present', async () => {
it('should save cloudSyncAnnouncement payload on Cloud_Sync_Announcement_Payload setting when present', async () => {
const workspaceSyncPayloadResponse = {
workspaceId: 'workspaceId',
publicKey: 'publicKey',
Expand Down Expand Up @@ -79,4 +79,21 @@ describe('SyncCloudData', () => {
),
).to.be.true;
});

it('Should ignore the setting update if cloudSyncAnnouncement is not present', async () => {
const workspaceSyncPayloadResponse = {
workspaceId: 'workspaceId',
publicKey: 'publicKey',
license: {},
removeLicense: false,
};

mockedFetchWorkspaceSyncPayload.resolves(workspaceSyncPayloadResponse);

await syncCloudData();

expect(mockedFetchWorkspaceSyncPayload.calledOnce).to.be.true;

expect(models.Settings.updateValueById.notCalled).to.be.true;
});
});

0 comments on commit f416564

Please sign in to comment.