Skip to content

Commit 7c4a826

Browse files
test: add scopeProfiles=false test confirming all profiles are included
1 parent 62280df commit 7c4a826

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

test/package/packageVersionCreate.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,36 @@ describe('Package Version Create', () => {
836836
expect(pkgTypeMembers[1].members).to.deep.equal(['Test Profile']);
837837
});
838838

839+
it('should include profiles from all package directories when scopeProfiles is false', async () => {
840+
project.getSfProjectJson().set('packageDirectories', [
841+
{ path: './src-access-management', package: 'ACCESS', versionName: 'ver 0.1', versionNumber: '0.1.0.NEXT' },
842+
{ path: 'force-app', package: 'TEST', versionName: 'ver 0.1', versionNumber: '0.1.0.NEXT', default: true },
843+
]);
844+
await project.getSfProjectJson().write();
845+
846+
const siblingDir = path.join(project.getPath(), 'src-access-management');
847+
await fs.promises.mkdir(siblingDir, { recursive: true });
848+
const fileContents = '<?xml version="1.0" encoding="UTF-8"?>';
849+
await fs.promises.writeFile(path.join(siblingDir, 'Sibling Profile.profile-meta.xml'), fileContents);
850+
await fs.promises.writeFile(
851+
path.join(project.getPath(), 'force-app', 'Target Profile.profile-meta.xml'),
852+
fileContents
853+
);
854+
855+
const pkgProfileApi = await PackageProfileApi.create({ project, includeUserLicenses: false });
856+
const types = [
857+
{ name: 'Layout', members: ['Test Layout'] },
858+
{ name: 'Profile', members: ['Sibling Profile', 'Target Profile'] },
859+
];
860+
861+
// With no excludedDirectories (scopeProfiles=false), all profiles from all dirs are included
862+
const pkgTypeMembers = pkgProfileApi.filterAndGenerateProfilesForManifest(types);
863+
expect(pkgTypeMembers.find((t) => t.name === 'Profile')?.members).to.deep.equal([
864+
'Sibling Profile',
865+
'Target Profile',
866+
]);
867+
});
868+
839869
it('should exclude profiles from ./-prefixed sibling package directories when scopeProfiles is true', async () => {
840870
// Configure a multi-directory project where sibling uses ./ prefix in path
841871
project.getSfProjectJson().set('packageDirectories', [

0 commit comments

Comments
 (0)