test: inject instead of deprecated TestBed get

Additionally refactor tests and ts-ignore annotations.
This commit is contained in:
Jovan Krunić
2022-02-22 13:29:04 +01:00
parent 37fe25c42f
commit 098b1d733e
12 changed files with 50 additions and 58 deletions

View File

@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/* eslint-disable @typescript-eslint/no-non-null-assertion,@typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/no-non-null-assertion, @typescript-eslint/ban-ts-comment */
import {
APP_BASE_HREF,
CommonModule,
@@ -103,7 +103,7 @@ describe('ContextMenuComponent', async () => {
fixture.detectChanges();
const sort: HTMLElement =
fixture.debugElement.nativeElement.querySelector('.context-sort');
// @ts-ignore
// @ts-expect-error not relevant for this case
const sortItem: HTMLElement = sort.querySelectorAll('.sort-item')[1];
sortItem!.click();
expect(instance.sortOption.value).toEqual('name');
@@ -148,7 +148,7 @@ describe('ContextMenuComponent', async () => {
expect(filterGroup).toBeDefined();
// @ts-ignore
// @ts-expect-error it is defined
const filterItems = filterGroup.querySelectorAll('.filter-item-label');
if (filterItems.length !== facet.buckets.length) {

View File

@@ -11,7 +11,7 @@ describe('ContextMenuService', () => {
TestBed.configureTestingModule({
providers: [ContextMenuService],
});
service = TestBed.get(ContextMenuService);
service = TestBed.inject(ContextMenuService);
});
it('should be created', () => {