Skip to content
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
3 changes: 3 additions & 0 deletions src/support/serenity/brand-aliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ export async function syncBrandAliasesAcrossMarkets(
if (!sameAliasSet(currentBrandNames, desiredBrandNames)) {
// eslint-disable-next-line no-await-in-loop
await transport.updateProject(workspaceId, projectId, {
// `type` is required on ProjectUpdateRequest — the Semrush gateway
// (and the PE mock) 400 a typeless PATCH. AIO projects are always 'ai'.
type: 'ai',
...(hasText(display) ? { brand_name_display: display } : {}),
brand_names: desiredBrandNames,
});
Expand Down
3 changes: 3 additions & 0 deletions test/support/serenity/brand-aliases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ describe('brand-aliases helpers', () => {
const result = await syncBrandAliasesAcrossMarkets(transport, aliases, 'Brand', WS, undefined);

expect(transport.updateProject).to.have.been.calledOnceWith(WS, 'p-us', {
type: 'ai',
brand_name_display: 'Brand',
brand_names: ['Brand', 'Acme', 'Acme Inc'],
});
Expand Down Expand Up @@ -122,6 +123,7 @@ describe('brand-aliases helpers', () => {
);

expect(transport.updateProject).to.have.been.calledOnceWith(WS, 'p-us', {
type: 'ai',
brand_name_display: 'Brand',
brand_names: ['Brand', 'Acme'],
});
Expand Down Expand Up @@ -231,6 +233,7 @@ describe('brand-aliases helpers', () => {
);

expect(transport.updateProject).to.have.been.calledOnceWith(WS, 'p-us', {
type: 'ai',
brand_names: ['Acme'], // no brand_name_display key
});
expect(transport.updateBenchmark).to.not.have.been.called;
Expand Down
Loading