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 jest regression in expect.objectContaining for observable variables #5569

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jest.mock('../../../../stores/MultiSelectionStore', () => jest.fn(
this.loading = false;
this.idFilterParameter = idFilterParameter;
this.loadItems = jest.fn();
this.items = [];

mockExtendObservable(this, {
items: [],
Expand Down Expand Up @@ -1231,14 +1232,16 @@ test('Should pass props correctly to MultiAutoComplete component', () => {
/>
);

expect(selection.find('MultiAutoComplete').at(0).props()).toEqual(expect.objectContaining({
expect(selection.find('MultiAutoComplete').at(0).props()).toEqual({
allowAdd: false,
disabled: true,
displayProperty: 'name',
id: '/',
idProperty: 'uuid',
options: {},
searchProperties: ['name'],
selectionStore: selection.instance().autoCompleteSelectionStore,
}));
});

expect(MultiSelectionStore).toBeCalledWith('snippets', value, locale, 'names');
});
Expand Down Expand Up @@ -1332,14 +1335,16 @@ test('Should pass props with schema-options type correctly to MultiAutoComplete
/>
);

expect(selection.find('MultiAutoComplete').props()).toEqual(expect.objectContaining({
expect(selection.find('MultiAutoComplete').props()).toEqual({
allowAdd: false,
disabled: true,
displayProperty: 'name',
id: '/',
idProperty: 'uuid',
options: {},
searchProperties: ['name'],
selectionStore: selection.instance().autoCompleteSelectionStore,
}));
});
});

test('Should trigger a reload of the auto_complete items if the value prop changes', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,8 @@ test('Should change excludeGhostsAndShadows when value of toggler is changed', (

const excludeGhostsAndShadows = webspaceOverview.instance().excludeGhostsAndShadows;
expect(excludeGhostsAndShadows.get()).toEqual(false);
expect(webspaceOverview.instance().listStore.observableOptions).toEqual(expect.objectContaining({
'exclude-ghosts': excludeGhostsAndShadows,
'exclude-shadows': excludeGhostsAndShadows,
}));
expect(webspaceOverview.instance().listStore.observableOptions['exclude-ghosts']).toEqual(excludeGhostsAndShadows);
expect(webspaceOverview.instance().listStore.observableOptions['exclude-shadows']).toEqual(excludeGhostsAndShadows);

let toolbarConfig = toolbarFunction.call(webspaceOverview.instance());
expect(toolbarConfig.items[0].value).toEqual(true);
Expand Down