Skip to content

Commit

Permalink
fix: Remove LastClonedBy and LastClonedDate fields from Snapshot (#427)
Browse files Browse the repository at this point in the history
* fix: Remove LastCloneBy and LastCloneDate fields

* fix: Remove LastClonedDate from test
  • Loading branch information
jfeng-salesforce authored Nov 14, 2023
1 parent 0b79e2d commit 2e77b43
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
11 changes: 1 addition & 10 deletions src/shared/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export interface OrgSnapshotRequest {
export type OrgSnapshot = OrgSnapshotRequest & {
Id: string;
Status: string;
LastClonedDate?: string;
LastClonedById?: string;
CreatedDate: string;
LastModifiedDate: string;
ExpirationDate?: string;
Expand All @@ -41,8 +39,6 @@ export const ORG_SNAPSHOT_FIELDS = [
'CreatedDate',
'LastModifiedDate',
'ExpirationDate',
'LastClonedDate',
'LastClonedById',
'Error',
];
const dateTimeFormatter = (dateString?: string): string =>
Expand Down Expand Up @@ -75,11 +71,6 @@ const ORG_SNAPSHOT_COLUMNS = {
header: 'Expiration Date',
get: (row: OrgSnapshot): string => (row.ExpirationDate ? new Date(row.ExpirationDate).toLocaleDateString() : ''),
},
LastClonedDate: {
header: 'Last Cloned Date',
get: (row: OrgSnapshot): string => rowDateTimeFormatter(row, 'LastClonedDate'),
},
LastClonedById: { header: 'Last Cloned By Id', get: (row: OrgSnapshot): string => row.LastClonedById ?? '' },
};

const invalidTypeErrorHandler = (e: unknown): never => {
Expand Down Expand Up @@ -124,7 +115,7 @@ export const printSingleRecordTable = (snapshotRecord: OrgSnapshot): void => {
.map(([key, value]: [string, string]) => ({
Name: capitalCase(key),
// format the datetime values
Value: ['LastModifiedDate', 'LastClonedDate', 'CreatedDate'].includes(key) ? dateTimeFormatter(value) : value,
Value: ['LastModifiedDate', 'CreatedDate'].includes(key) ? dateTimeFormatter(value) : value,
}))
// null/undefined becomes empty string
.map((row) => (row.Value ? row : { ...row, Value: '' })),
Expand Down
4 changes: 0 additions & 4 deletions test/nuts/snapshots.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ describe('snapshot commands', () => {
ensureExitCode: 0,
}).shellOutput.stdout;
expect(table).to.include('Snapshot Name');
expect(table).to.include('Last Cloned Date');
expect(table).to.not.include('SnapshotName');
expect(table).to.not.include('LastClonedDate');

// time fixes
expect(table).not.to.include('.000+0000');
Expand All @@ -133,9 +131,7 @@ describe('snapshot commands', () => {
ensureExitCode: 0,
}).shellOutput.stdout;
expect(table).to.include('Snapshot Name');
expect(table).to.include('Last Cloned Date');
expect(table).to.not.include('SnapshotName');
expect(table).to.not.include('LastClonedDate');

// time fixes
expect(table).not.to.include('.000+0000');
Expand Down

0 comments on commit 2e77b43

Please sign in to comment.