Skip to content

Commit

Permalink
fix some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fpbrault committed Aug 29, 2024
1 parent 7a906c3 commit 96e2962
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 36 deletions.
17 changes: 0 additions & 17 deletions packages/atomic/cypress/e2e/search-interface.cypress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,22 +358,5 @@ describe('Search Interface Component', () => {
);
});
});

describe('with doNotTrack', () => {
beforeEach(() => {
fixture.withDoNotTrack().init();
});

it('should not call the analytics server', () => {
cy.wait(TestFixture.interceptAliases.Search);
cy.shouldBeCalled(TestFixture.interceptAliases.UA, 0);
});

it('should not include analytics in the search request', () => {
cy.wait(TestFixture.interceptAliases.Search).should((firstSearch) =>
expect(firstSearch.request.body).not.to.have.property('analytics')
);
});
});
});
});
15 changes: 1 addition & 14 deletions packages/atomic/cypress/fixtures/test-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export class TestFixture {
private language?: string;
private localizationCompatibilityVersion: i18nCompatibilityVersion = 'v4';
private disabledAnalytics = false;
private doNotTrack = false;
private fieldCaptions: {field: string; captions: Record<string, string>}[] =
[];
private translations: Record<string, string> = {};
Expand Down Expand Up @@ -136,11 +135,6 @@ export class TestFixture {
return this;
}

public withDoNotTrack() {
this.doNotTrack = true;
return this;
}

public withRedirection() {
this.redirected = true;
return this;
Expand Down Expand Up @@ -210,13 +204,6 @@ export class TestFixture {
setupIntercept();
spyConsole();

cy.window().then((win) => {
Object.defineProperty(win.navigator, 'doNotTrack', {
get: () => (this.doNotTrack ? '1' : '0'),
configurable: true,
});
});

cy.document().then((doc) => {
doc.head.appendChild(this.style);
doc.body.appendChild(this.searchInterface);
Expand Down Expand Up @@ -273,7 +260,7 @@ export class TestFixture {

if (this.execFirstSearch && this.firstIntercept) {
cy.wait(TestFixture.interceptAliases.Search);
if (!(this.disabledAnalytics || this.doNotTrack)) {
if (!this.disabledAnalytics) {
cy.wait(TestFixture.interceptAliases.UA);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,15 @@ export default class QuanticCategoryFacet extends LightningElement {
}
get values() {
return this.state?.values ?? [];
return this.state?.valuesAsTrees ?? [];
}
get nonActiveParents() {
return this.state?.parents?.slice(0, -1) ?? [];
return this.state?.selectedValueAncestry?.slice(0, -1) ?? [];
}
get activeParent() {
return this.state?.parents?.slice(-1)[0];
return this.state?.selectedValueAncestry?.slice(-1)[0];
}
get activeParentFormattedValue() {
Expand All @@ -314,11 +314,11 @@ export default class QuanticCategoryFacet extends LightningElement {
}

get hasParents() {
return this.state?.parents?.length;
return this.state?.selectedValueAncestry?.length;
}

get hasValues() {
return this.state?.values?.length;
return this.state?.valuesAsTrees?.length;
}

get hasSearchResults() {
Expand Down

0 comments on commit 96e2962

Please sign in to comment.