Skip to content

Commit

Permalink
fix: if no component set to match against, skip checking server respo…
Browse files Browse the repository at this point in the history
…nse (#1311)
  • Loading branch information
WillieRuemmele authored May 14, 2024
1 parent 2daff4e commit 2d7fa28
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/metadataApiDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ const buildFileResponsesFromComponentSet =
)
.concat(deleteNotFoundToFileResponses(cs)(responseMessages));

warnIfUnmatchedServerResult(fileResponses)(responseMessages);
if (cs.size) {
warnIfUnmatchedServerResult(fileResponses)(responseMessages);
}
return fileResponses;
};
/**
Expand Down
43 changes: 43 additions & 0 deletions test/client/metadataApiDeploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,49 @@ describe('MetadataApiDeploy', () => {
warnSpy.restore();
emitSpy.restore();
});
it('should NOT warn when empty component set used', () => {
// everything is an emit. Warn calls emit, too.
const warnSpy = $$.SANDBOX.stub(Lifecycle.prototype, 'emitWarning');
const emitSpy = $$.SANDBOX.stub(Lifecycle.prototype, 'emit');

const component = matchingContentFile.COMPONENT;
const deployedSet = new ComponentSet([]);
const { fullName, type } = component;

const apiStatus: Partial<MetadataApiDeployStatus> = {
details: {
componentFailures: [
{
changed: 'true',
created: 'false',
deleted: 'false',
success: 'true',
fullName,
fileName: component.content,
componentType: type.name,
} as DeployMessage,
{
changed: 'false',
created: 'false',
deleted: 'true',
success: 'true',
fullName: 'myServerOnlyComponent',
fileName: 'myServerOnlyComponent',
componentType: type.name,
} as DeployMessage,
],
},
};
const result = new DeployResult(apiStatus as MetadataApiDeployStatus, deployedSet);

const responses = result.getFileResponses();

expect(responses).to.deep.equal([]);
expect(warnSpy.called).to.be.false;

warnSpy.restore();
emitSpy.restore();
});

it('should not report duplicates component', () => {
const component = matchingContentFile.COMPONENT;
Expand Down

0 comments on commit 2d7fa28

Please sign in to comment.