Skip to content

Commit

Permalink
fix: unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mikerodonnell89 committed Feb 7, 2025
1 parent 2237289 commit 8dd1429
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ describe('TableViewSettingsDialogComponent', () => {
const queryList = new QueryList<TableViewSettingsFilterComponent>();
const mockTable = new TableComponentMock();
const setViewSettingsFiltersSpy = jest
.spyOn(mockTable, 'showFilterSettingsInToolbar')
.spyOn(mockTable, 'showSettingsInToolbar')
.mockImplementation(() => {});

queryList.reset([mockFilterComponent]);
Expand All @@ -260,20 +260,19 @@ describe('TableViewSettingsDialogComponent', () => {

component.ngAfterViewInit();

expect(setViewSettingsFiltersSpy).toHaveBeenCalledTimes(1);
expect(setViewSettingsFiltersSpy).toHaveBeenCalledTimes(2);
expect(setViewSettingsFiltersSpy).toHaveBeenCalledWith(true);

queryList.reset([]);
component.filters.notifyOnChanges();

expect(setViewSettingsFiltersSpy).toHaveBeenCalledTimes(2);
expect(setViewSettingsFiltersSpy).toHaveBeenCalledWith(false);
expect(setViewSettingsFiltersSpy).toHaveBeenCalledTimes(2); // not called again because the filters array length must be > 0
});

it('should listen to table columns stream and notify table if "sort settings" is available', () => {
const mockTable = new TableComponentMock();
const showSortSettingsInToolbarSpy = jest
.spyOn(mockTable, 'showSortSettingsInToolbar')
.spyOn(mockTable, 'showSettingsInToolbar')
.mockImplementation(() => {});

component.table = mockTable as any;
Expand All @@ -292,7 +291,7 @@ describe('TableViewSettingsDialogComponent', () => {
it('should listen to table columns stream and notify table if "group settings" is available', () => {
const mockTable = new TableComponentMock();
const showGroupSettingsInToolbarSpy = jest
.spyOn(mockTable, 'showGroupSettingsInToolbar')
.spyOn(mockTable, 'showSettingsInToolbar')
.mockImplementation(() => {});

component.table = mockTable as any;
Expand Down

0 comments on commit 8dd1429

Please sign in to comment.