Skip to content

Commit

Permalink
test: update UT
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Dec 4, 2024
1 parent 2568ca5 commit ab25027
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions test/unit/remote/fileOperations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe('writing file version based on env', () => {
RevisionCounter: 1,
MemberName: 'MyClass',
IsNewMember: false,
LastModifiedDate: new Date().toJSON(),
} satisfies MemberRevision,
],
]);
Expand Down Expand Up @@ -97,6 +98,7 @@ describe('upgrading undefined file version to v1 file', () => {
IsNameObsolete: false,
RevisionCounter: 1,
MemberName: 'MyClass',
LastModifiedDate: 'unknown',
} satisfies Omit<MemberRevision, 'IsNewMember'>);
});

Expand Down
10 changes: 8 additions & 2 deletions test/unit/remote/remoteSourceTracking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { RemoteSyncInput, RemoteChangeElement } from '../../../src/shared/types'
import * as orgQueryMocks from '../../../src/shared/remote/orgQueries';

import { getMetadataNameFromKey, getMetadataTypeFromKey } from '../../../src/shared/functions';
import { ContentsV0, MemberRevision, SourceMember } from '../../../src/shared/remote/types';
import { ContentsV0, ContentsV1, MemberRevision, SourceMember } from '../../../src/shared/remote/types';

config.truncateThreshold = 0;

Expand All @@ -34,6 +34,7 @@ const defaultSourceMemberValues = {
RevisionCounter: 1,
ChangedBy: 'Shelby McLaughlin',
MemberIdOrName: '00eO4000003cP5JIAU',
LastModifiedDate: new Date().toJSON(),
} satisfies Partial<SourceMember>;

const getSourceMember = (revision: number, isDeleted = false): SourceMember => ({
Expand Down Expand Up @@ -126,6 +127,7 @@ describe('remoteSourceTrackingService', () => {
changedBy: 'Shelby McLaughlin',
revisionCounter: 1,
memberIdOrName,
lastModifiedDate: defaultSourceMemberValues.LastModifiedDate,
};
const changeResult = remoteChangeElementToChangeResult(rce);
expect(changeResult).to.deep.equal({
Expand All @@ -137,6 +139,7 @@ describe('remoteSourceTrackingService', () => {
changedBy: 'Shelby McLaughlin',
revisionCounter: 1,
memberIdOrName,
lastModifiedDate: defaultSourceMemberValues.LastModifiedDate,
});
});

Expand All @@ -149,6 +152,7 @@ describe('remoteSourceTrackingService', () => {
changedBy: 'Shelby McLaughlin',
revisionCounter: 1,
memberIdOrName,
lastModifiedDate: defaultSourceMemberValues.LastModifiedDate,
};
const changeResult = remoteChangeElementToChangeResult(rce);
expect(changeResult).to.deep.equal({
Expand All @@ -160,6 +164,7 @@ describe('remoteSourceTrackingService', () => {
changedBy: 'Shelby McLaughlin',
revisionCounter: 1,
memberIdOrName,
lastModifiedDate: defaultSourceMemberValues.LastModifiedDate,
});
});
});
Expand Down Expand Up @@ -564,6 +569,7 @@ describe('remoteSourceTrackingService', () => {
});
const contents = {
serverMaxRevisionCounter: 1,
fileVersion: 1,
sourceMembers: {
'Profile###my(awesome)profile': {
...defaultSourceMemberValues,
Expand All @@ -575,7 +581,7 @@ describe('remoteSourceTrackingService', () => {
MemberType: 'Profile',
},
},
};
} satisfies ContentsV1;
setContents(contents);
await remoteSourceTrackingService.syncSpecifiedElements([
{
Expand Down

0 comments on commit ab25027

Please sign in to comment.