Skip to content

Commit df8e534

Browse files
lucas-a-pelegrinoggazzo
authored andcommitted
tests: adds more unit tests for syncCloudData method
1 parent f19483f commit df8e534

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

apps/meteor/tests/unit/app/cloud/server/functions/syncWorkspace/syncCloudData.spec.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('SyncCloudData', () => {
3131
mockedFetchWorkspaceSyncPayload.reset();
3232
});
3333

34-
it('should save cloudSyncAnnouncement on Cloud_Sync_Announcement_Payload when present', async () => {
34+
it('should save cloudSyncAnnouncement payload on Cloud_Sync_Announcement_Payload setting when present', async () => {
3535
const workspaceSyncPayloadResponse = {
3636
workspaceId: 'workspaceId',
3737
publicKey: 'publicKey',
@@ -79,4 +79,21 @@ describe('SyncCloudData', () => {
7979
),
8080
).to.be.true;
8181
});
82+
83+
it('Should ignore the setting update if cloudSyncAnnouncement is not present', async () => {
84+
const workspaceSyncPayloadResponse = {
85+
workspaceId: 'workspaceId',
86+
publicKey: 'publicKey',
87+
license: {},
88+
removeLicense: false,
89+
};
90+
91+
mockedFetchWorkspaceSyncPayload.resolves(workspaceSyncPayloadResponse);
92+
93+
await syncCloudData();
94+
95+
expect(mockedFetchWorkspaceSyncPayload.calledOnce).to.be.true;
96+
97+
expect(models.Settings.updateValueById.notCalled).to.be.true;
98+
});
8299
});

0 commit comments

Comments
 (0)