-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: sample project for matching hash moves
- Loading branch information
Showing
12 changed files
with
607 additions
and
0 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
test/nuts/local/localTrackingFileMoveChildrenWithSameHash.nut.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright (c) 2020, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
|
||
import * as path from 'node:path'; | ||
import { TestSession } from '@salesforce/cli-plugins-testkit'; | ||
import { expect } from 'chai'; | ||
import * as fs from 'graceful-fs'; | ||
import { RegistryAccess } from '@salesforce/source-deploy-retrieve'; | ||
import { ShadowRepo } from '../../../src/shared/local/localShadowRepo'; | ||
|
||
describe('can match files with the same hash when the have different parents ', () => { | ||
const registry = new RegistryAccess(); | ||
let session: TestSession; | ||
let repo: ShadowRepo; | ||
let filesToSync: string[]; | ||
|
||
before(async () => { | ||
session = await TestSession.create({ | ||
project: { | ||
sourceDir: path.join('test', 'nuts', 'vivek-project'), | ||
}, | ||
devhubAuthStrategy: 'NONE', | ||
}); | ||
}); | ||
|
||
after(async () => { | ||
// await session?.clean(); | ||
}); | ||
|
||
it('initialize the local tracking', async () => { | ||
repo = await ShadowRepo.getInstance({ | ||
orgId: 'fakeOrgId', | ||
projectPath: session.project.dir, | ||
packageDirs: [ | ||
{ | ||
path: path.join('sfdx-source', 'packaged'), | ||
name: 'packaged', | ||
fullPath: path.join(session.project.dir, 'sfdx-source', 'packaged'), | ||
}, | ||
{ | ||
path: path.join('sfdx-source', 'unsorted'), | ||
name: 'unsorted', | ||
fullPath: path.join(session.project.dir, 'sfdx-source', 'unsorted'), | ||
}, | ||
], | ||
registry, | ||
}); | ||
await fs.promises.mkdir(path.join(session.project.dir, 'sfdx-source', 'unsorted', 'main', 'default', 'objects'), { | ||
recursive: true, | ||
}); | ||
}); | ||
|
||
it('should show 0 files (images) in git status after moving them', async () => { | ||
// eslint-disable-next-line no-unused-expressions | ||
expect(process.env.SF_BETA_TRACK_FILE_MOVES).to.be.undefined; | ||
process.env.SF_BETA_TRACK_FILE_MOVES = 'true'; | ||
// Commit the existing class files | ||
filesToSync = await repo.getChangedFilenames(); | ||
await repo.commitChanges({ deployedFiles: filesToSync }); | ||
|
||
const topDir = path.join(session.project.dir, 'sfdx-source'); | ||
// move all the classes to the new folder | ||
fs.renameSync( | ||
path.join(topDir, 'packaged', 'main', 'objects', 'Workbook__c'), | ||
path.join(topDir, 'unsorted', 'main', 'default', 'objects', 'Workbook__c') | ||
); | ||
|
||
fs.renameSync( | ||
path.join(topDir, 'packaged', 'main', 'objects', 'Workshop__c'), | ||
path.join(topDir, 'unsorted', 'main', 'default', 'objects', 'Workshop__c') | ||
); | ||
|
||
await repo.getStatus(true); | ||
|
||
expect(await repo.getChangedFilenames()) | ||
.to.be.an('array') | ||
.with.lengthOf(0); | ||
|
||
delete process.env.SF_BETA_TRACK_FILE_MOVES; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# List files or directories below to ignore them when running "sf project deploy start" or "sf project retrieve start". | ||
# Run "sf project list ignored" at the command line to validate the list of ignored source files. | ||
# More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm | ||
# | ||
|
||
# Package XML files | ||
package.xml | ||
|
||
# LWC configuration files | ||
**/jsconfig.json | ||
**/.eslintrc.json | ||
|
||
# LWC Jest | ||
**/__tests__/** | ||
|
||
# Metadata Types to Fully Ignore | ||
**/appMenus | ||
**/duplicateRules | ||
|
||
# Profiles | ||
**.profile-meta.xml | ||
|
||
# Uncomment to NOT ignore the Admin profile | ||
#!**Admin.profile-meta.xml | ||
|
||
# Ignore the default permission set | ||
**/permissionsets/sfdcInternalInt__sfdc_scrt2.permissionset-meta.xml | ||
|
||
# Ignore Placeholder files | ||
**.placeholder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"name": "sfdx-falcon-template", | ||
"private": true, | ||
"description": "A Salesforce DX project template optimized for building second-generation packaging.", | ||
"version": "2.0.0", | ||
"author": "Vivek M. Chawla @VivekMChawla", | ||
"license": "BSD-3-Clause", | ||
"bugs": "https://github.com/sfdx-isv/sfdx-falcon-template/issues", | ||
"homepage": "https://github.com/sfdx-isv/sfdx-falcon-template", | ||
"repository": "sfdx-isv/sfdx-falcon-template", | ||
"main": "sfdx-project.json", | ||
"keywords": [ | ||
"salesforce", "sfdx-plugin", "sfdx-falcon", "sfdx" | ||
], | ||
"scripts": { | ||
"lint": "eslint **/{aura,lwc}/**", | ||
"test": "npm run test:unit", | ||
"test:unit": "sfdx-lwc-jest", | ||
"test:unit:watch": "sfdx-lwc-jest --watch", | ||
"test:unit:debug": "sfdx-lwc-jest --debug", | ||
"test:unit:coverage": "sfdx-lwc-jest --coverage", | ||
"prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", | ||
"prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", | ||
"postinstall": "husky install", | ||
"precommit": "lint-staged" | ||
}, | ||
"devDependencies": { | ||
"@lwc/eslint-plugin-lwc": "^1.1.2", | ||
"@prettier/plugin-xml": "^2.0.1", | ||
"@salesforce/eslint-config-lwc": "^3.2.3", | ||
"@salesforce/eslint-plugin-aura": "^2.0.0", | ||
"@salesforce/eslint-plugin-lightning": "^1.0.0", | ||
"@salesforce/sfdx-lwc-jest": "^1.1.0", | ||
"eslint": "^8.11.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-jest": "^26.1.2", | ||
"husky": "^7.0.4", | ||
"lint-staged": "^12.3.7", | ||
"prettier": "^2.6.0", | ||
"prettier-plugin-apex": "^1.10.0" | ||
}, | ||
"lint-staged": { | ||
"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ | ||
"prettier --write" | ||
], | ||
"**/{aura,lwc}/**": [ | ||
"eslint" | ||
] | ||
}, | ||
"files": [ | ||
"/.husky", | ||
"/.vscode", | ||
"/config", | ||
"/data", | ||
"/mdapi-source", | ||
"/scripts", | ||
"/sfdx-source", | ||
".forceignore", | ||
".gitignore", | ||
".prettierignore", | ||
".prettierrc", | ||
"jest.config.js", | ||
"LICENSE", | ||
"package.json", | ||
"README.md", | ||
"sfdx-project.json" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"packageDirectories": [ | ||
{ | ||
"path": "sfdx-source/packaged", | ||
"default": false, | ||
"scopeProfiles": true, | ||
"package": "Training Hub", | ||
"versionName": "Summer '24", | ||
"versionNumber": "99.0.0.NEXT", | ||
"versionDescription": "Summer 2024 Release" | ||
}, | ||
{ | ||
"path": "sfdx-source/unpackaged", | ||
"default": false | ||
}, | ||
{ | ||
"path": "sfdx-source/unsorted", | ||
"default": true | ||
} | ||
], | ||
"name": "training-hub-package", | ||
"namespace": "training_hub", | ||
"sfdcLoginUrl": "https://login.salesforce.com", | ||
"sourceApiVersion": "60.0", | ||
"packageAliases": { | ||
"Training Hub": "0Ho8X0000004CBOSA2" | ||
} | ||
} |
167 changes: 167 additions & 0 deletions
167
...s/vivek-project/sfdx-source/packaged/main/objects/Workbook__c/Workbook__c.object-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<actionOverrides> | ||
<actionName>Accept</actionName> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Accept</actionName> | ||
<formFactor>Large</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Accept</actionName> | ||
<formFactor>Small</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>CancelEdit</actionName> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>CancelEdit</actionName> | ||
<formFactor>Large</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>CancelEdit</actionName> | ||
<formFactor>Small</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Clone</actionName> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Clone</actionName> | ||
<formFactor>Large</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Clone</actionName> | ||
<formFactor>Small</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Delete</actionName> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Delete</actionName> | ||
<formFactor>Large</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Delete</actionName> | ||
<formFactor>Small</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Edit</actionName> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Edit</actionName> | ||
<formFactor>Large</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Edit</actionName> | ||
<formFactor>Small</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>List</actionName> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>List</actionName> | ||
<formFactor>Large</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>List</actionName> | ||
<formFactor>Small</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>New</actionName> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>New</actionName> | ||
<formFactor>Large</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>New</actionName> | ||
<formFactor>Small</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>SaveEdit</actionName> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>SaveEdit</actionName> | ||
<formFactor>Large</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>SaveEdit</actionName> | ||
<formFactor>Small</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Tab</actionName> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Tab</actionName> | ||
<formFactor>Large</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>Tab</actionName> | ||
<formFactor>Small</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>View</actionName> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>View</actionName> | ||
<formFactor>Large</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<actionOverrides> | ||
<actionName>View</actionName> | ||
<formFactor>Small</formFactor> | ||
<type>Default</type> | ||
</actionOverrides> | ||
<allowInChatterGroups>false</allowInChatterGroups> | ||
<compactLayoutAssignment>SYSTEM</compactLayoutAssignment> | ||
<deploymentStatus>Deployed</deploymentStatus> | ||
<description>Represents a Workbook</description> | ||
<enableActivities>true</enableActivities> | ||
<enableBulkApi>false</enableBulkApi> | ||
<enableFeeds>false</enableFeeds> | ||
<enableHistory>true</enableHistory> | ||
<enableLicensing>false</enableLicensing> | ||
<enableReports>true</enableReports> | ||
<enableSearch>true</enableSearch> | ||
<enableSharing>false</enableSharing> | ||
<enableStreamingApi>false</enableStreamingApi> | ||
<externalSharingModel>Private</externalSharingModel> | ||
<label>Workbook</label> | ||
<nameField> | ||
<label>Workbook Name</label> | ||
<trackHistory>false</trackHistory> | ||
<type>Text</type> | ||
</nameField> | ||
<pluralLabel>Workbooks</pluralLabel> | ||
<searchLayouts></searchLayouts> | ||
<sharingModel>ReadWrite</sharingModel> | ||
<visibility>Public</visibility> | ||
</CustomObject> |
Oops, something went wrong.