Skip to content

Commit

Permalink
fix: add to component set even if unresolved source (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Powell authored and brpowell committed Dec 3, 2020
1 parent 9fdf131 commit c2dd4b1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export {
MetadataApiDeployOptions,
RetrieveOptions,
RetrievePathOptions,
RetrieveStatus,
SourceDeployResult,
RetrieveMessage,
SourceRetrieveResult,
Expand Down
4 changes: 2 additions & 2 deletions src/collections/componentSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ export class ComponentSet implements Iterable<MetadataComponent> {
ws.apiVersion = manifestObj.Package.version;

for (const component of ComponentSet.getComponentsFromManifestObject(manifestObj, registry)) {
const memberIsWildcard = component.fullName === ComponentSet.WILDCARD;
if (shouldResolve) {
filterSet.add(component);
}
if (!shouldResolve || (memberIsWildcard && options?.literalWildcard)) {
const memberIsWildcard = component.fullName === ComponentSet.WILDCARD;
if (!memberIsWildcard || options?.literalWildcard || !shouldResolve) {
ws.add(component);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export {
MetadataApiDeployOptions,
RetrieveOptions,
RetrievePathOptions,
RetrieveStatus,
SourceDeployResult,
RetrieveMessage,
SourceRetrieveResult,
Expand Down
17 changes: 16 additions & 1 deletion test/collections/componentSet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,25 @@ describe('ComponentSet', () => {
{ fullName: '*', type: mockRegistryData.types.mixedcontentsinglefile },
...sourceComponents,
]);

it('should add components even if they were not resolved', async () => {
const set = await ComponentSet.fromManifestFile('folderComponent.xml', {
registry: mockRegistry,
tree,
resolve: '.',
});

expect(Array.from(set)).to.deep.equal([
{
fullName: 'Test_Folder',
type: mockRegistryData.types.tinafeyfolder,
},
]);
});
});
});

describe('fromComponents', () => {
describe('constructor', () => {
it('should initialize non-source backed components from members', () => {
const set = new ComponentSet(
[
Expand Down

0 comments on commit c2dd4b1

Please sign in to comment.