Skip to content

Commit

Permalink
Fix stencil build
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeaudoincoveo authored and louis-bompart committed Sep 4, 2024
1 parent 16cb55d commit 2a7282e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 34 deletions.
9 changes: 1 addition & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/atomic-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"@angular/cli": "17.3.9",
"@angular/compiler-cli": "17.3.12",
"@coveo/headless": "2.80.0",
"@types/jasmine": "5.1.4",
"@types/node": "20.14.12",
"jasmine-core": "5.2.0",
"karma": "6.4.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {buildInteractiveResult, TestUtils} from '@coveo/headless';
import {buildInteractiveResult, Result, SearchEngine} from '@coveo/headless';
import {h} from '@stencil/core';
import {newSpecPage, SpecPage} from '@stencil/core/testing';
import {MissingParentError} from '../../common/item-list/item-decorators';
Expand Down Expand Up @@ -54,17 +54,15 @@ describe('resultContext method', () => {
});

it("revolves the bindings when it's a child of an atomic-result element", async () => {
const mockEngine = TestUtils.buildMockSearchEngine(
TestUtils.createMockState()
);
const mockResult = TestUtils.buildMockResult();
const mockEngine = jest.mocked({} as SearchEngine);
const mockResult = jest.mocked({} as Result);

const page = await newSpecPage({
components: [AtomicResult],
template: () => (
<atomic-result
content={document.createElement('div')}
result={TestUtils.buildMockResult()}
result={mockResult}
interactiveResult={buildInteractiveResult(mockEngine, {
options: {result: mockResult},
})}
Expand Down
6 changes: 3 additions & 3 deletions packages/atomic/src/utils/initialization-utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {buildSearchBox, Controller, TestUtils} from '@coveo/headless';
import {buildSearchBox, Controller, SearchEngine} from '@coveo/headless';
import {newSpecPage, SpecPage} from '@stencil/core/testing';
import i18next from 'i18next';
import {AtomicSearchBox} from '../components/search/atomic-search-box/atomic-search-box';
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('InitializeBindings decorator', () => {
it(`when "engine" is defined
should render the content `, () => {
component['bindings'] = {
engine: TestUtils.buildMockSearchEngine(TestUtils.createMockState()),
engine: jest.mocked({} as SearchEngine),
i18n: i18next,
store: createAtomicStore(),
interfaceElement: document.createElement('atomic-search-interface'),
Expand All @@ -127,7 +127,7 @@ describe('BindStateToController decorator', () => {
console.error = jest.fn();
component = {
bindings: {
engine: TestUtils.buildMockSearchEngine(TestUtils.createMockState()),
engine: jest.mocked({} as SearchEngine),
i18n: i18next,
store: createAtomicStore(),
interfaceElement: document.createElement('atomic-search-interface'),
Expand Down
25 changes: 12 additions & 13 deletions packages/atomic/src/utils/result-utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import {
buildSearchEngine,
getSampleSearchEngineConfiguration,
Raw,
Result,
} from '@coveo/headless';
import {TestUtils} from '@coveo/headless';
import {Bindings} from '../components/search/atomic-search-interface/atomic-search-interface';
import {buildStringTemplateFromResult} from './result-utils';

describe('buildStringTemplateFromResult', () => {
const mockRaw = jest.mocked({source: 'the source'} as Raw);
const mockResult = jest.mocked({
title: 'foo',
uri: 'http://uri.foo.com',
raw: mockRaw,
} as Result);
const engine = buildSearchEngine({
configuration: getSampleSearchEngineConfiguration(),
});
const bindings = {engine} as Bindings;
const result = TestUtils.buildMockResult({
title: 'foo',
uri: 'http://uri.foo.com',
raw: {
...TestUtils.buildMockResult().raw,
source: 'the source',
},
});

it('should create string templates', () => {
const templates = [
Expand All @@ -30,9 +29,9 @@ describe('buildStringTemplateFromResult', () => {
];

templates.forEach((template) =>
expect(buildStringTemplateFromResult(template.in, result, bindings)).toBe(
template.out
)
expect(
buildStringTemplateFromResult(template.in, mockResult, bindings)
).toBe(template.out)
);
});

Expand All @@ -41,7 +40,7 @@ describe('buildStringTemplateFromResult', () => {
expect(
buildStringTemplateFromResult(
'${title}/${raw.notafield}',
result,
mockResult,
bindings
)
).toBe('foo/');
Expand Down
5 changes: 2 additions & 3 deletions packages/samples/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@
"@angular-devkit/build-angular": "17.3.9",
"@angular/cli": "17.3.9",
"@angular/compiler-cli": "17.3.12",
"@types/jasmine": "5.1.4",
"@types/node": "20.14.12",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"cypress": "13.13.1",
"cypress-repeat": "2.3.5",
"gts": "5.3.1",
"jest": "29.7.0",
"ncp": "2.0.0",
"typescript": "5.4.5",
"jest": "29.7.0"
"typescript": "5.4.5"
}
}

0 comments on commit 2a7282e

Please sign in to comment.