Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: if no component set to match against, skip checking server response #1311

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading