From 1c09206983255b44f06b17715489a16a83815ce7 Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Wed, 11 Oct 2023 16:42:02 +0300 Subject: [PATCH] ci: enable jest all (#5593) Co-authored-by: taiga-family-bot --- package-lock.json | 8 +- package.json | 2 +- .../test/input-card-grouped.component.spec.ts | 16 ++-- .../test/input-card.component.spec.ts | 28 +++--- .../money/test/integer-part.pipe.spec.ts | 32 +++---- .../money/test/money-options.spec.ts | 14 +-- .../money/test/money.component.spec.ts | 36 +++---- .../tests/format-card.pipe.spec.ts | 24 ++--- .../utils/test/get-currency-by-code.spec.ts | 2 +- .../utils/test/get-currency-symbol.spec.ts | 6 +- .../components/code/tests/highlight.spec.ts | 5 +- .../tests/language-switcher.component.spec.ts | 4 +- .../page/tests/page.component.spec.ts | 4 +- .../addon-doc/utils/test/coerce-value.spec.ts | 6 +- .../transliterate-keyboard-layout.spec.ts | 12 +-- .../tests/mobile-calendar.component.spec.ts | 2 +- .../test/preview-pagination.spec.ts | 10 +- .../test/direction-order.directive.spec.ts | 4 +- .../test/table-bars-host.component.spec.ts | 11 +-- .../tests/abstract-control-no-control.spec.ts | 96 +++++++++---------- .../abstract-control-with-control.spec.ts | 88 ++++++++--------- .../tests/abstract-tui-controller.spec.ts | 2 +- .../test/dropdown-portal.service.spec.ts | 10 +- projects/cdk/date-time/test/day.spec.ts | 20 ++-- projects/cdk/date-time/test/month.spec.ts | 20 ++-- projects/cdk/date-time/test/time.spec.ts | 20 ++-- projects/cdk/date-time/test/year.spec.ts | 20 ++-- projects/cdk/decorators/test/debounce.spec.ts | 8 +- .../test/default-prop-and-pure.spec.ts | 12 +-- projects/cdk/decorators/test/pure.spec.ts | 10 +- .../tests/active-zone.directive.spec.ts | 24 ++--- .../test/droppable.directive.spec.ts | 4 +- .../zoom/test/zoom.directive.spec.ts | 4 +- .../observables/test/control-value.spec.ts | 2 +- .../cdk/pipes/mapper/test/mapper.pipe.spec.ts | 2 +- .../pipes/replace/test/replace.pipe.spec.ts | 14 +-- .../tests/schematic-ng-add-standalone.spec.ts | 22 ++--- .../ng-add/tests/schematic-ng-add.spec.ts | 16 ++-- .../schematic-replace-deep-imports.spec.ts | 6 +- .../v3/tests/schematic-replace-enums.spec.ts | 2 +- .../v3/tests/schematic-replace-html.spec.ts | 2 +- .../cdk/services/test/resize.service.spec.ts | 2 +- .../cdk/utils/color/test/hex-to-rgba.spec.ts | 6 +- .../utils/dom/test/contains-or-after.spec.ts | 6 +- .../dom/test/get-clipboard-data-text.spec.ts | 2 +- .../dom/test/get-element-obscurers.spec.ts | 2 +- .../utils/dom/test/get-scroll-parent.spec.ts | 2 +- .../utils/dom/test/is-current-target.spec.ts | 2 +- .../cdk/utils/dom/test/is-node-in.spec.ts | 6 +- .../focus/tests/get-closest-keyboard.spec.ts | 4 +- .../focus/tests/is-native-focused-in.spec.ts | 4 +- .../tests/is-native-mouse-focusable.spec.ts | 8 +- .../calendar/test/calendar.component.spec.ts | 8 +- .../expand/test/expand.component.spec.ts | 4 +- .../loader/test/loader-options.spec.ts | 6 +- .../test/primitive-calendar.component.spec.ts | 8 +- .../primitive-spin-button.component.spec.ts | 4 +- .../primitive-year-picker.component.spec.ts | 2 +- .../dropdown/test/dropdown.directive.spec.ts | 2 +- .../hint/test/hint.directive.spec.ts | 2 +- .../core/utils/dom/tests/get-viewport.spec.ts | 20 ++-- .../utils/format/test/format-phone.spec.ts | 2 +- projects/demo/test/bump.spec.ts | 10 +- .../test/accordion.component.spec.ts | 2 +- .../action/test/action.component.spec.ts | 2 +- .../avatar/tests/avatar-options.spec.ts | 6 +- .../badge/test/badge.component.spec.ts | 8 +- .../test/calendar-month.component.spec.ts | 4 +- .../test/combo-box.component.spec.ts | 2 +- .../test/input-count.component.spec.ts | 4 +- .../test/input-date-range.component.spec.ts | 2 +- .../test/input-date-time.component.spec.ts | 10 +- .../test/input-month-range.component.spec.ts | 2 +- .../test/input-number.component.spec.ts | 38 ++++---- ...nput-phone-international.component.spec.ts | 8 +- .../test/input-phone.component.spec.ts | 2 +- .../test/input-tag-no-mode.component.spec.ts | 2 +- .../test/input-tag.component.spec.ts | 44 ++++----- .../test/multi-select.component.spec.ts | 4 +- .../rating/tests/rating.component.spec.ts | 90 ++++++++--------- .../test/generate-dialogable-route.spec.ts | 4 +- .../components/tag/test/tag-options.spec.ts | 6 +- .../test/iso-to-country-code.pipe.spec.ts | 6 +- .../pipes/stringify/stringify.pipe.spec.ts | 6 +- .../format/test/string-hash-to-hsl.spec.ts | 6 +- .../test/get-max-allowed-phone-length.spec.ts | 6 +- 86 files changed, 495 insertions(+), 511 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0eb35b1eed65..cebe0ee0f025 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,7 @@ "@taiga-ui/browserslist-config": "0.2.0", "@taiga-ui/commitlint-config": "0.2.1", "@taiga-ui/cspell-config": "0.15.0", - "@taiga-ui/eslint-plugin-experience": "0.9.1", + "@taiga-ui/eslint-plugin-experience": "0.10.2", "@taiga-ui/prettier-config": "0.3.1", "@taiga-ui/stylelint-config": "0.5.1", "@testing-library/cypress": "9.0.0", @@ -7852,9 +7852,9 @@ "link": true }, "node_modules/@taiga-ui/eslint-plugin-experience": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/@taiga-ui/eslint-plugin-experience/-/eslint-plugin-experience-0.9.1.tgz", - "integrity": "sha512-rWSzLq1GoxQpePi6aZ/QuXoHedpVjcLLPfbiL6ub5TyRrGeZcoZbl3YbXD31/6faCeL0GchBY2hTjc8DfTGNDg==", + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/@taiga-ui/eslint-plugin-experience/-/eslint-plugin-experience-0.10.2.tgz", + "integrity": "sha512-lwa14+SjCnTTwcBMlgoIXlJc9VioWPLi4kMfvdUXl9T20tcg3LJmVSGf4BW4+phBo4Rv8DEy3L4XS3WfxX+IUw==", "dev": true, "dependencies": { "@angular-eslint/eslint-plugin": "16.2.0", diff --git a/package.json b/package.json index 11f279b7a80e..801f55e1b61c 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "@taiga-ui/browserslist-config": "0.2.0", "@taiga-ui/commitlint-config": "0.2.1", "@taiga-ui/cspell-config": "0.15.0", - "@taiga-ui/eslint-plugin-experience": "0.9.1", + "@taiga-ui/eslint-plugin-experience": "0.10.2", "@taiga-ui/prettier-config": "0.3.1", "@taiga-ui/stylelint-config": "0.5.1", "@testing-library/cypress": "9.0.0", diff --git a/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts b/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts index 9aba682f518b..b3f73eb9fc05 100644 --- a/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts +++ b/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts @@ -212,9 +212,9 @@ describe(`InputCardGrouped`, () => { beforeEach(() => setCard(`4111 1111 1111 1111`)); it(`input-card-grouped have a default icon`, () => { - expect(testComponent.control.valid).toEqual(true); - expect(testComponent.component.defaultIcon).toEqual(`tuiIconVisaMono`); - expect(testComponent.component.icon).toEqual(`tuiIconVisaMono`); + expect(testComponent.control.valid).toBe(true); + expect(testComponent.component.defaultIcon).toBe(`tuiIconVisaMono`); + expect(testComponent.component.icon).toBe(`tuiIconVisaMono`); expect(testComponent.control.value).toEqual({card: `4111 1111 1111 1111`}); expect(expectCardOutlet()).toBeFalsy(); @@ -225,9 +225,9 @@ describe(`InputCardGrouped`, () => { it(`input-card-grouped have tuiIconMastercard icon`, () => { testComponent.component.cardSrc = `tuiIconMastercard`; - expect(testComponent.control.valid).toEqual(true); - expect(testComponent.component.defaultIcon).toEqual(`tuiIconVisaMono`); - expect(testComponent.component.icon).toEqual(`tuiIconMastercard`); + expect(testComponent.control.valid).toBe(true); + expect(testComponent.component.defaultIcon).toBe(`tuiIconVisaMono`); + expect(testComponent.component.icon).toBe(`tuiIconMastercard`); expect(testComponent.control.value).toEqual({card: `4111 1111 1111 1111`}); expect(expectCardOutlet()).toBeFalsy(); @@ -239,8 +239,8 @@ describe(`InputCardGrouped`, () => { testComponent.component.cardSrc = fixture.componentInstance.customIconTemplate; - expect(testComponent.control.valid).toEqual(true); - expect(testComponent.component.defaultIcon).toEqual(`tuiIconVisaMono`); + expect(testComponent.control.valid).toBe(true); + expect(testComponent.component.defaultIcon).toBe(`tuiIconVisaMono`); expect(testComponent.component.icon).toBeInstanceOf(TemplateRef); expect(testComponent.control.value).toEqual({card: `4111 1111 1111 1111`}); diff --git a/projects/addon-commerce/components/input-card/test/input-card.component.spec.ts b/projects/addon-commerce/components/input-card/test/input-card.component.spec.ts index 8e300b2f7b9e..317ddd1058cd 100644 --- a/projects/addon-commerce/components/input-card/test/input-card.component.spec.ts +++ b/projects/addon-commerce/components/input-card/test/input-card.component.spec.ts @@ -49,13 +49,13 @@ describe(`InputCard`, () => { it(`enabled`, () => { testComponent.component.autocompleteEnabled = true; - expect(testComponent.component.autocompleteCard).toEqual(`cc-number`); + expect(testComponent.component.autocompleteCard).toBe(`cc-number`); }); it(`disabled`, () => { testComponent.component.autocompleteEnabled = false; - expect(testComponent.component.autocompleteCard).toEqual(`off`); + expect(testComponent.component.autocompleteCard).toBe(`off`); }); }); @@ -63,11 +63,11 @@ describe(`InputCard`, () => { it(`touched`, () => { testComponent.component.onFocused(true); - expect(testComponent.component.control?.touched).toEqual(false); + expect(testComponent.component.control?.touched).toBe(false); testComponent.component.onFocused(false); - expect(testComponent.component.control?.touched).toEqual(true); + expect(testComponent.component.control?.touched).toBe(true); }); }); @@ -88,8 +88,8 @@ describe(`InputCard`, () => { testComponent.component.onValueChange(`1234 5678 1111 2222`); expect(testComponent.onBinChange).toHaveBeenCalledWith(`123456`); - expect(testComponent.component.value).toEqual(`1234567811112222`); - expect(testComponent.component.bin).toEqual(`123456`); + expect(testComponent.component.value).toBe(`1234567811112222`); + expect(testComponent.component.bin).toBe(`123456`); testComponent.component.onValueChange(`2222 4444 5555 6666`); expect(testComponent.onBinChange).toHaveBeenCalledTimes(2); @@ -205,24 +205,24 @@ describe(`InputCard`, () => { beforeEach(() => testComponent.control.setValue(`4111 1111 1111 1111`)); it(`input-card component has a default icon`, () => { - expect(testComponent.control.valid).toEqual(true); - expect(testComponent.component.icon).toEqual(`tuiIconVisaMono`); - expect(testComponent.control.value).toEqual(`4111 1111 1111 1111`); + expect(testComponent.control.valid).toBe(true); + expect(testComponent.component.icon).toBe(`tuiIconVisaMono`); + expect(testComponent.control.value).toBe(`4111 1111 1111 1111`); }); it(`input-card component has a tuiIconElectron icon`, () => { testComponent.component.cardSrc = `tuiIconElectron`; - expect(testComponent.control.valid).toEqual(true); - expect(testComponent.component.icon).toEqual(`tuiIconElectron`); - expect(testComponent.control.value).toEqual(`4111 1111 1111 1111`); + expect(testComponent.control.valid).toBe(true); + expect(testComponent.component.icon).toBe(`tuiIconElectron`); + expect(testComponent.control.value).toBe(`4111 1111 1111 1111`); }); it(`input-card component has an icon source as TemplateRef`, () => { testComponent.component.cardSrc = fixture.componentInstance.customIconTemplateRef; - expect(testComponent.control.valid).toEqual(true); + expect(testComponent.control.valid).toBe(true); expect(testComponent.component.icon).toBeInstanceOf(TemplateRef); - expect(testComponent.control.value).toEqual(`4111 1111 1111 1111`); + expect(testComponent.control.value).toBe(`4111 1111 1111 1111`); }); }); diff --git a/projects/addon-commerce/components/money/test/integer-part.pipe.spec.ts b/projects/addon-commerce/components/money/test/integer-part.pipe.spec.ts index 6ed3491a7fb0..d40758a41fb1 100644 --- a/projects/addon-commerce/components/money/test/integer-part.pipe.spec.ts +++ b/projects/addon-commerce/components/money/test/integer-part.pipe.spec.ts @@ -9,13 +9,13 @@ describe(`TuiIntegerPart`, () => { decimalLimit: 2, }); - expect(pipe.transform(10123.123)).toEqual(`10 123`); - expect(pipe.transform(10123)).toEqual(`10 123`); - expect(pipe.transform(null as unknown as number)).toEqual(`0`); - expect(pipe.transform(undefined as unknown as number)).toEqual(`NaN`); - expect(pipe.transform(`` as unknown as number)).toEqual(`0`); - expect(pipe.transform(`10,5` as unknown as number)).toEqual(`NaN`); - expect(pipe.transform(`10.5` as unknown as number)).toEqual(`10`); + expect(pipe.transform(10123.123)).toBe(`10 123`); + expect(pipe.transform(10123)).toBe(`10 123`); + expect(pipe.transform(null as unknown as number)).toBe(`0`); + expect(pipe.transform(undefined as unknown as number)).toBe(`NaN`); + expect(pipe.transform(`` as unknown as number)).toBe(`0`); + expect(pipe.transform(`10,5` as unknown as number)).toBe(`NaN`); + expect(pipe.transform(`10.5` as unknown as number)).toBe(`10`); }); describe(`Config with rounding`, () => { @@ -25,9 +25,9 @@ describe(`TuiIntegerPart`, () => { rounding: `round`, }); - expect(pipe.transform(2004.87)).toEqual(`2 004`); - expect(pipe.transform(1000.87)).toEqual(`1 000`); - expect(pipe.transform(100.99, 1)).toEqual(`101`); + expect(pipe.transform(2004.87)).toBe(`2 004`); + expect(pipe.transform(1000.87)).toBe(`1 000`); + expect(pipe.transform(100.99, 1)).toBe(`101`); }); it(`ceil`, () => { @@ -36,9 +36,9 @@ describe(`TuiIntegerPart`, () => { rounding: `ceil`, }); - expect(pipe.transform(2004.87)).toEqual(`2 004`); - expect(pipe.transform(1000.87)).toEqual(`1 000`); - expect(pipe.transform(100.99, 1)).toEqual(`101`); + expect(pipe.transform(2004.87)).toBe(`2 004`); + expect(pipe.transform(1000.87)).toBe(`1 000`); + expect(pipe.transform(100.99, 1)).toBe(`101`); }); it(`floor`, () => { @@ -47,9 +47,9 @@ describe(`TuiIntegerPart`, () => { rounding: `floor`, }); - expect(pipe.transform(2004.87)).toEqual(`2 004`); - expect(pipe.transform(1000.87)).toEqual(`1 000`); - expect(pipe.transform(100.99, 1)).toEqual(`100`); + expect(pipe.transform(2004.87)).toBe(`2 004`); + expect(pipe.transform(1000.87)).toBe(`1 000`); + expect(pipe.transform(100.99, 1)).toBe(`100`); }); }); }); diff --git a/projects/addon-commerce/components/money/test/money-options.spec.ts b/projects/addon-commerce/components/money/test/money-options.spec.ts index 4ee89f6d7480..5af538629319 100644 --- a/projects/addon-commerce/components/money/test/money-options.spec.ts +++ b/projects/addon-commerce/components/money/test/money-options.spec.ts @@ -40,12 +40,12 @@ describe(`Money component options`, () => { }); it(`override by custom options`, () => { - expect(testComponent.component.currency).toEqual(`EUR`); - expect(testComponent.component.sign).toEqual(`never`); - expect(testComponent.component.singleColor).toEqual(false); - expect(testComponent.component.precision).toEqual(1); - expect(testComponent.component.colored).toEqual(false); - expect(testComponent.component.red).toEqual(false); - expect(testComponent.component.signSymbol).toEqual(``); + expect(testComponent.component.currency).toBe(`EUR`); + expect(testComponent.component.sign).toBe(`never`); + expect(testComponent.component.singleColor).toBe(false); + expect(testComponent.component.precision).toBe(1); + expect(testComponent.component.colored).toBe(false); + expect(testComponent.component.red).toBe(false); + expect(testComponent.component.signSymbol).toBe(``); }); }); diff --git a/projects/addon-commerce/components/money/test/money.component.spec.ts b/projects/addon-commerce/components/money/test/money.component.spec.ts index 925053c1e051..f944219ea3c5 100644 --- a/projects/addon-commerce/components/money/test/money.component.spec.ts +++ b/projects/addon-commerce/components/money/test/money.component.spec.ts @@ -68,7 +68,7 @@ describe(`Money`, () => { `${testContext.prefix}currency`, ); - expect(currency?.nativeElement.textContent?.trim()).toEqual(``); + expect(currency?.nativeElement.textContent?.trim()).toBe(``); }); it(`if empty string is passed, currency symbol is not shown`, () => { @@ -79,7 +79,7 @@ describe(`Money`, () => { `${testContext.prefix}currency`, ); - expect(currency?.nativeElement.textContent?.trim()).toEqual(``); + expect(currency?.nativeElement.textContent?.trim()).toBe(``); }); it(`words with currency code`, () => { @@ -90,7 +90,7 @@ describe(`Money`, () => { `${testContext.prefix}currency`, ); - expect(currency?.nativeElement.textContent?.trim()).toEqual(`$`); + expect(currency?.nativeElement.textContent?.trim()).toBe(`$`); }); it(`works with currency name`, () => { @@ -101,7 +101,7 @@ describe(`Money`, () => { `${testContext.prefix}currency`, ); - expect(currency?.nativeElement.textContent?.trim()).toEqual(`$`); + expect(currency?.nativeElement.textContent?.trim()).toBe(`$`); }); it(`works with custom currency`, () => { @@ -124,7 +124,7 @@ describe(`Money`, () => { `${testContext.prefix}fraction-part`, ); - expect(fraction?.nativeElement.textContent).toEqual(``); + expect(fraction?.nativeElement.textContent).toBe(``); }); it(`non zero decimals a padded with zeroes by default`, () => { @@ -135,7 +135,7 @@ describe(`Money`, () => { `${testContext.prefix}fraction-part`, ); - expect(fraction?.nativeElement.textContent).toEqual(`,10`); + expect(fraction?.nativeElement.textContent).toBe(`,10`); }); it(`truncating float values`, () => { @@ -154,7 +154,7 @@ describe(`Money`, () => { tuiReplaceNbsp( `${integer?.nativeElement.textContent}${fraction?.nativeElement.textContent}`, ), - ).toEqual(`23 724,99`); + ).toBe(`23 724,99`); }); it(`decimals only show 2 digits`, () => { @@ -165,7 +165,7 @@ describe(`Money`, () => { `${testContext.prefix}fraction-part`, ); - expect(fraction?.nativeElement.textContent).toEqual(`,12`); + expect(fraction?.nativeElement.textContent).toBe(`,12`); }); it(`if ALWAYS is set, zero decimals are shown`, () => { @@ -176,7 +176,7 @@ describe(`Money`, () => { `${testContext.prefix}fraction-part`, ); - expect(fraction?.nativeElement.textContent).toEqual(`,00`); + expect(fraction?.nativeElement.textContent).toBe(`,00`); }); it(`if Never is set, non zero decimals are not shown`, () => { @@ -188,7 +188,7 @@ describe(`Money`, () => { `${testContext.prefix}fraction-part`, ); - expect(fraction?.nativeElement.textContent).toEqual(``); + expect(fraction?.nativeElement.textContent).toBe(``); }); it(`if precision = 4, shows 4 digits of decimal part`, () => { @@ -200,7 +200,7 @@ describe(`Money`, () => { `${testContext.prefix}fraction-part`, ); - expect(fraction?.nativeElement.textContent).toEqual(`,1230`); + expect(fraction?.nativeElement.textContent).toBe(`,1230`); }); }); @@ -208,7 +208,7 @@ describe(`Money`, () => { it(`by default plus is not shown`, () => { const sign = pageObject.getByAutomationId(`${testContext.prefix}sign`); - expect(sign?.nativeElement.textContent).toEqual(``); + expect(sign?.nativeElement.textContent).toBe(``); }); it(`by default minus is not shown`, () => { @@ -226,7 +226,7 @@ describe(`Money`, () => { const sign = pageObject.getByAutomationId(`${testContext.prefix}sign`); - expect(sign?.nativeElement.textContent).toEqual(`+`); + expect(sign?.nativeElement.textContent).toBe(`+`); }); it(`if set to ALWAYS, minus is shown`, () => { @@ -245,7 +245,7 @@ describe(`Money`, () => { const sign = pageObject.getByAutomationId(`${testContext.prefix}sign`); - expect(sign?.nativeElement.textContent).toEqual(``); + expect(sign?.nativeElement.textContent).toBe(``); }); it(`if set to Never, minus is not shown`, () => { @@ -255,7 +255,7 @@ describe(`Money`, () => { const sign = pageObject.getByAutomationId(`${testContext.prefix}sign`); - expect(sign?.nativeElement.textContent).toEqual(``); + expect(sign?.nativeElement.textContent).toBe(``); }); it(`if set to FORCE_NEGATIVE, minus is shown for positive numbers`, () => { @@ -283,7 +283,7 @@ describe(`Money`, () => { const sign = pageObject.getByAutomationId(`${testContext.prefix}sign`); - expect(sign?.nativeElement.textContent).toEqual(`+`); + expect(sign?.nativeElement.textContent).toBe(`+`); }); it(`if set to FORCE_POSITIVE, plus is shown for negative numbers`, () => { @@ -293,7 +293,7 @@ describe(`Money`, () => { const sign = pageObject.getByAutomationId(`${testContext.prefix}sign`); - expect(sign?.nativeElement.textContent).toEqual(`+`); + expect(sign?.nativeElement.textContent).toBe(`+`); }); }); @@ -369,6 +369,6 @@ describe(`Money`, () => { const textContent = fixture.debugElement.nativeElement.textContent; - expect(textContent).toEqual(`237`); + expect(textContent).toBe(`237`); }); }); diff --git a/projects/addon-commerce/pipes/format-card/tests/format-card.pipe.spec.ts b/projects/addon-commerce/pipes/format-card/tests/format-card.pipe.spec.ts index 6d800cee1b46..ccdc372c6568 100644 --- a/projects/addon-commerce/pipes/format-card/tests/format-card.pipe.spec.ts +++ b/projects/addon-commerce/pipes/format-card/tests/format-card.pipe.spec.ts @@ -4,24 +4,24 @@ describe(`TuiFormatCardPipe`, () => { const pipe = new TuiFormatCardPipe(); it(`value is empty`, () => { - expect(pipe.transform()).toEqual(``); - expect(pipe.transform(undefined)).toEqual(``); - expect(pipe.transform(null)).toEqual(``); - expect(pipe.transform(null, true)).toEqual(``); - expect(pipe.transform(undefined, true)).toEqual(``); - expect(pipe.transform(null, true)).toEqual(``); + expect(pipe.transform()).toBe(``); + expect(pipe.transform(undefined)).toBe(``); + expect(pipe.transform(null)).toBe(``); + expect(pipe.transform(null, true)).toBe(``); + expect(pipe.transform(undefined, true)).toBe(``); + expect(pipe.transform(null, true)).toBe(``); }); it(`value has card`, () => { - expect(pipe.transform(`1234`)).toEqual(`1234`); - expect(pipe.transform(`123456`)).toEqual(`1234 56`); - expect(pipe.transform(`1234567891011111`)).toEqual(`1234 5678 9101 1111`); + expect(pipe.transform(`1234`)).toBe(`1234`); + expect(pipe.transform(`123456`)).toBe(`1234 56`); + expect(pipe.transform(`1234567891011111`)).toBe(`1234 5678 9101 1111`); }); it(`card value has whitespaces`, () => { - expect(pipe.transform(`1234 5678 9101`)).toEqual(`1234 567 8 91 01`); - expect(pipe.transform(`1234 5678 9101 1111`)).toEqual(`1234 567 8 91 01 1 111`); - expect(pipe.transform(`1234 56 78 9101 11 11`)).toEqual( + expect(pipe.transform(`1234 5678 9101`)).toBe(`1234 567 8 91 01`); + expect(pipe.transform(`1234 5678 9101 1111`)).toBe(`1234 567 8 91 01 1 111`); + expect(pipe.transform(`1234 56 78 9101 11 11`)).toBe( `1234 56 78 9 101 11 1 1`, ); }); diff --git a/projects/addon-commerce/utils/test/get-currency-by-code.spec.ts b/projects/addon-commerce/utils/test/get-currency-by-code.spec.ts index 580c27841881..f8edb5f55338 100644 --- a/projects/addon-commerce/utils/test/get-currency-by-code.spec.ts +++ b/projects/addon-commerce/utils/test/get-currency-by-code.spec.ts @@ -8,7 +8,7 @@ import { describe(`tuiGetCurrencyByCode`, () => { it(`AED`, () => { expect(tuiGetCurrencyByCode(TuiCurrencyCode.Dirham)).toEqual(TuiCurrency.Dirham); - expect(tuiGetCurrencyByCode(TuiCurrencyCode.Dirham)?.toString()).toEqual(`AED`); + expect(tuiGetCurrencyByCode(TuiCurrencyCode.Dirham)?.toString()).toBe(`AED`); }); it(`the same number of keys`, () => { diff --git a/projects/addon-commerce/utils/test/get-currency-symbol.spec.ts b/projects/addon-commerce/utils/test/get-currency-symbol.spec.ts index d7f7a5327e3b..f94f7ca548e5 100644 --- a/projects/addon-commerce/utils/test/get-currency-symbol.spec.ts +++ b/projects/addon-commerce/utils/test/get-currency-symbol.spec.ts @@ -15,7 +15,7 @@ describe(`getCurrencySymbol`, () => { }); it(`returns null if symbol not found`, () => { - expect(tuiGetCurrencySymbol(`CSTM`)).toBe(null); + expect(tuiGetCurrencySymbol(`CSTM`)).toBeNull(); }); }); @@ -132,7 +132,7 @@ describe(`getCurrencySymbol`, () => { }); it(`unknown`, () => { - expect(tuiGetCurrencySymbol(`unknown`)).toBe(null); - expect(tuiGetCurrencySymbol(`unknown`)).toBe(null); + expect(tuiGetCurrencySymbol(`unknown`)).toBeNull(); + expect(tuiGetCurrencySymbol(`unknown`)).toBeNull(); }); }); diff --git a/projects/addon-doc/components/code/tests/highlight.spec.ts b/projects/addon-doc/components/code/tests/highlight.spec.ts index f420be2dd278..8ceab2999392 100644 --- a/projects/addon-doc/components/code/tests/highlight.spec.ts +++ b/projects/addon-doc/components/code/tests/highlight.spec.ts @@ -45,15 +45,12 @@ describe(`Highlight Directive`, () => { }).compileComponents(); loader = TestBed.inject(HighlightLoader); - })); - - beforeEach(() => { fixture = TestBed.createComponent(TestHighlightComponent); component = fixture.componentInstance; directiveElement = fixture.debugElement.query(By.directive(Highlight)); directiveInstance = directiveElement.injector.get(Highlight); fixture.detectChanges(); - }); + })); it(`should create highlight directive`, () => { expect(directiveInstance).not.toBeNull(); diff --git a/projects/addon-doc/components/language-switcher/tests/language-switcher.component.spec.ts b/projects/addon-doc/components/language-switcher/tests/language-switcher.component.spec.ts index f754f7789387..4ecff9d3741c 100644 --- a/projects/addon-doc/components/language-switcher/tests/language-switcher.component.spec.ts +++ b/projects/addon-doc/components/language-switcher/tests/language-switcher.component.spec.ts @@ -15,9 +15,7 @@ describe(`TuiLanguageSwitcherComponent`, () => { imports: [ReactiveFormsModule, TuiSelectModule, TuiDataListModule], providers: [TuiLanguageSwitcher], }).compileComponents(); - }); - beforeEach(() => { fixture = TestBed.createComponent(TuiLanguageSwitcherComponent); component = fixture.componentInstance; fixture.detectChanges(); @@ -34,7 +32,7 @@ describe(`TuiLanguageSwitcherComponent`, () => { it(`should correct return path to icon flag`, () => { expect(component.getFlagPath).toBeTruthy(); - expect(component.getFlagPath(TuiCountryIsoCode.CN)).toEqual( + expect(component.getFlagPath(TuiCountryIsoCode.CN)).toBe( `assets/taiga-ui/icons/CN.png`, ); }); diff --git a/projects/addon-doc/components/page/tests/page.component.spec.ts b/projects/addon-doc/components/page/tests/page.component.spec.ts index fd9911c2798d..050be2f5e6c4 100644 --- a/projects/addon-doc/components/page/tests/page.component.spec.ts +++ b/projects/addon-doc/components/page/tests/page.component.spec.ts @@ -21,9 +21,7 @@ describe(`TuiDocPageComponent`, () => { }, ], }).compileComponents(); - }); - beforeEach(() => { fixture = TestBed.createComponent(TuiDocPageComponent); component = fixture.componentInstance; fixture.detectChanges(); @@ -67,6 +65,6 @@ describe(`TuiDocPageComponent`, () => { }); it(`should have false value when Input deprecated is not supplied`, () => { - expect(component.deprecated).toEqual(false); + expect(component.deprecated).toBe(false); }); }); diff --git a/projects/addon-doc/utils/test/coerce-value.spec.ts b/projects/addon-doc/utils/test/coerce-value.spec.ts index a827747bb47c..12a630b7e17c 100644 --- a/projects/addon-doc/utils/test/coerce-value.spec.ts +++ b/projects/addon-doc/utils/test/coerce-value.spec.ts @@ -33,9 +33,9 @@ describe(`coercing values`, () => { }); it(`string -> null`, () => { - expect(tuiCoerceValue(`null`)).toBe(null); - expect(tuiCoerceValue(`undefined`)).toBe(null); - expect(tuiCoerceValue(`NaN`)).toBe(null); + expect(tuiCoerceValue(`null`)).toBeNull(); + expect(tuiCoerceValue(`undefined`)).toBeNull(); + expect(tuiCoerceValue(`NaN`)).toBeNull(); }); it(`string -> array`, () => { diff --git a/projects/addon-doc/utils/test/transliterate-keyboard-layout.spec.ts b/projects/addon-doc/utils/test/transliterate-keyboard-layout.spec.ts index ad61e4bfa1de..219629803167 100644 --- a/projects/addon-doc/utils/test/transliterate-keyboard-layout.spec.ts +++ b/projects/addon-doc/utils/test/transliterate-keyboard-layout.spec.ts @@ -2,20 +2,20 @@ import {tuiTransliterateKeyboardLayout} from '@taiga-ui/addon-doc'; describe(`tuiTransliterateKeyboardLayout`, () => { it(`should return empty string for empty input`, () => { - expect(tuiTransliterateKeyboardLayout(``)).toEqual(``); + expect(tuiTransliterateKeyboardLayout(``)).toBe(``); }); it(`should transliterate Russian layout characters into English layout characters`, () => { // cspell:disable-next-line - expect(tuiTransliterateKeyboardLayout(`привет мир`)).toEqual(`ghbdtn vbh`); + expect(tuiTransliterateKeyboardLayout(`привет мир`)).toBe(`ghbdtn vbh`); // cspell:disable-next-line - expect(tuiTransliterateKeyboardLayout(`ыудусе`)).toEqual(`select`); + expect(tuiTransliterateKeyboardLayout(`ыудусе`)).toBe(`select`); // cspell:disable-next-line - expect(tuiTransliterateKeyboardLayout(`штзге еуче`)).toEqual(`input text`); + expect(tuiTransliterateKeyboardLayout(`штзге еуче`)).toBe(`input text`); }); it(`should not change non-Russian layout characters`, () => { - expect(tuiTransliterateKeyboardLayout(`hello world`)).toEqual(`hello world`); - expect(tuiTransliterateKeyboardLayout(`select`)).toEqual(`select`); + expect(tuiTransliterateKeyboardLayout(`hello world`)).toBe(`hello world`); + expect(tuiTransliterateKeyboardLayout(`select`)).toBe(`select`); }); }); diff --git a/projects/addon-mobile/components/mobile-calendar/tests/mobile-calendar.component.spec.ts b/projects/addon-mobile/components/mobile-calendar/tests/mobile-calendar.component.spec.ts index 86ff9e7a9cbf..879b7f485c2c 100644 --- a/projects/addon-mobile/components/mobile-calendar/tests/mobile-calendar.component.spec.ts +++ b/projects/addon-mobile/components/mobile-calendar/tests/mobile-calendar.component.spec.ts @@ -200,7 +200,7 @@ describe(`MobileCalendar`, () => { const value = testComponent.onConfirm.mock.calls[0][0]; - expect(value.year <= 1950).toBe(true); + expect(value.year).toBeLessThanOrEqual(1950); done(); }, waitCdkScrollToIndex); }); diff --git a/projects/addon-preview/components/preview/pagination/test/preview-pagination.spec.ts b/projects/addon-preview/components/preview/pagination/test/preview-pagination.spec.ts index 121372744b12..835350366ed4 100644 --- a/projects/addon-preview/components/preview/pagination/test/preview-pagination.spec.ts +++ b/projects/addon-preview/components/preview/pagination/test/preview-pagination.spec.ts @@ -42,13 +42,13 @@ describe(`PreviewPagination`, () => { testComponent.component.onArrowClick(1); fixture.detectChanges(); - expect(testComponent.index).toEqual(1); + expect(testComponent.index).toBe(1); }); it(`left arrow disabled`, () => { const arrowLeft = getLeftArrow(); - expect(arrowLeft.hasAttribute(`disabled`)).toEqual(true); + expect(arrowLeft.hasAttribute(`disabled`)).toBe(true); }); it(`left arrow enabled`, () => { @@ -57,7 +57,7 @@ describe(`PreviewPagination`, () => { const arrowLeft = getLeftArrow(); - expect(arrowLeft.hasAttribute(`disabled`)).toEqual(false); + expect(arrowLeft.hasAttribute(`disabled`)).toBe(false); }); it(`right arrow disabled`, () => { @@ -66,13 +66,13 @@ describe(`PreviewPagination`, () => { const arrowRight = getRightArrow(); - expect(arrowRight.hasAttribute(`disabled`)).toEqual(true); + expect(arrowRight.hasAttribute(`disabled`)).toBe(true); }); it(`right arrow enabled`, () => { const arrowRight = getRightArrow(); - expect(arrowRight.hasAttribute(`disabled`)).toEqual(false); + expect(arrowRight.hasAttribute(`disabled`)).toBe(false); }); }); diff --git a/projects/addon-table/components/table/directives/test/direction-order.directive.spec.ts b/projects/addon-table/components/table/directives/test/direction-order.directive.spec.ts index e04b4da7ae28..b44b62c99322 100644 --- a/projects/addon-table/components/table/directives/test/direction-order.directive.spec.ts +++ b/projects/addon-table/components/table/directives/test/direction-order.directive.spec.ts @@ -43,14 +43,14 @@ describe(`TuiDirectionOrder directive`, () => { it(`sets the sort direction of table to ascending`, () => { fixture.detectChanges(); - expect(testComponent.table.direction).toEqual(1); + expect(testComponent.table.direction).toBe(1); }); it(`sets the sort direction of table to descending`, () => { testComponent.directionOrder = `desc`; fixture.detectChanges(); - expect(testComponent.table.direction).toEqual(-1); + expect(testComponent.table.direction).toBe(-1); }); describe(`when table emits direction change`, () => { diff --git a/projects/addon-tablebars/components/table-bars-host/test/table-bars-host.component.spec.ts b/projects/addon-tablebars/components/table-bars-host/test/table-bars-host.component.spec.ts index 96f632e1242e..9bef87ef052e 100644 --- a/projects/addon-tablebars/components/table-bars-host/test/table-bars-host.component.spec.ts +++ b/projects/addon-tablebars/components/table-bars-host/test/table-bars-host.component.spec.ts @@ -51,6 +51,7 @@ describe(`TableBarsHost`, () => { component = testComponent.component; service = TestBed.inject(TuiTableBarsService); (service.bar$ as any)._events = []; + subscription?.unsubscribe(); }); function getBar(): DebugElement { @@ -61,12 +62,6 @@ describe(`TableBarsHost`, () => { return pageObject.getByAutomationId(`${testContext.prefix}close-button`)!; } - beforeEach(() => { - if (subscription) { - subscription.unsubscribe(); - } - }); - it(`Listens to service for adding tableBar`, () => { let result: unknown; @@ -93,7 +88,7 @@ describe(`TableBarsHost`, () => { tick(100); - expect(result).toBe(null); + expect(result).toBeNull(); })); it(`the default tableBar is dark`, () => { @@ -138,6 +133,6 @@ describe(`TableBarsHost`, () => { getCloseButton().nativeElement.click(); - expect(result).toBe(null); + expect(result).toBeNull(); }); }); diff --git a/projects/cdk/abstract/tests/abstract-control-no-control.spec.ts b/projects/cdk/abstract/tests/abstract-control-no-control.spec.ts index 904f6a8d03f8..9365e788fc38 100644 --- a/projects/cdk/abstract/tests/abstract-control-no-control.spec.ts +++ b/projects/cdk/abstract/tests/abstract-control-no-control.spec.ts @@ -106,97 +106,97 @@ describe(`AbstractTuiControl and NgControl not injected in MyControlComponent`, it(`default behaviour`, () => { expect(controlInstance).toBeTruthy(); expect(controlInstance.child.parent).toBeInstanceOf(MyControlComponent); - expect(controlInstance.readOnly).toEqual(false); - expect(controlInstance.nativeId).toEqual(``); - - expect(controlInstance.getTransformers()).toEqual(null); - expect(controlInstance.value).toEqual(`fallback`); - expect(controlInstance.safeCurrentValue).toEqual(`fallback`); - expect(controlInstance.invalid).toEqual(false); - expect(controlInstance.valid).toEqual(false); - expect(controlInstance.touched).toEqual(false); - expect(controlInstance.disabled).toEqual(false); - expect(controlInstance.interactive).toEqual(true); - expect(controlInstance.control).toEqual(null); + expect(controlInstance.readOnly).toBe(false); + expect(controlInstance.nativeId).toBe(``); + + expect(controlInstance.getTransformers()).toBeNull(); + expect(controlInstance.value).toBe(`fallback`); + expect(controlInstance.safeCurrentValue).toBe(`fallback`); + expect(controlInstance.invalid).toBe(false); + expect(controlInstance.valid).toBe(false); + expect(controlInstance.touched).toBe(false); + expect(controlInstance.disabled).toBe(false); + expect(controlInstance.interactive).toBe(true); + expect(controlInstance.control).toBeNull(); }); it(`pseudo`, () => { - expect(controlInstance.pseudoFocus).toEqual(null); - expect(controlInstance.pseudoHover).toEqual(null); - expect(controlInstance.pseudoActive).toEqual(null); - expect(controlInstance.pseudoInvalid).toEqual(null); + expect(controlInstance.pseudoFocus).toBeNull(); + expect(controlInstance.pseudoHover).toBeNull(); + expect(controlInstance.pseudoActive).toBeNull(); + expect(controlInstance.pseudoInvalid).toBeNull(); }); it(`computed`, () => { - expect(controlInstance.computedName).toEqual(null); - expect(controlInstance.computedDisabled).toEqual(false); - expect(controlInstance.computedInvalid).toEqual(false); - expect(controlInstance.computedFocusable).toEqual(true); - expect(controlInstance.computedFocusVisible).toEqual(false); - expect(controlInstance.computedFocused).toEqual(false); + expect(controlInstance.computedName).toBeNull(); + expect(controlInstance.computedDisabled).toBe(false); + expect(controlInstance.computedInvalid).toBe(false); + expect(controlInstance.computedFocusable).toBe(true); + expect(controlInstance.computedFocusVisible).toBe(false); + expect(controlInstance.computedFocused).toBe(false); controlInstance.pseudoFocus = true; controlInstance.pseudoHover = true; controlInstance.pseudoActive = true; - expect(controlInstance.computedFocusable).toEqual(true); - expect(controlInstance.computedFocusVisible).toEqual(true); - expect(controlInstance.computedFocused).toEqual(true); + expect(controlInstance.computedFocusable).toBe(true); + expect(controlInstance.computedFocusVisible).toBe(true); + expect(controlInstance.computedFocused).toBe(true); }); it(`focusable`, () => { const focusedChange = jest.spyOn(controlInstance.focusedChange, `emit`); - expect(controlInstance.focused).toEqual(false); - expect(controlInstance.focusable).toEqual(true); - expect(controlInstance.touched).toEqual(false); + expect(controlInstance.focused).toBe(false); + expect(controlInstance.focusable).toBe(true); + expect(controlInstance.touched).toBe(false); expect(focusedChange).not.toHaveBeenCalled(); controlInstance.forceUpdateFocused(true); - expect(controlInstance.focused).toEqual(true); - expect(controlInstance.focusable).toEqual(true); - expect(controlInstance.touched).toEqual(false); + expect(controlInstance.focused).toBe(true); + expect(controlInstance.focusable).toBe(true); + expect(controlInstance.touched).toBe(false); expect(focusedChange).toHaveBeenCalled(); controlInstance.forceUpdateFocused(false); - expect(controlInstance.focused).toEqual(false); - expect(controlInstance.focusable).toEqual(true); - expect(controlInstance.touched).toEqual(false); + expect(controlInstance.focused).toBe(false); + expect(controlInstance.focusable).toBe(true); + expect(controlInstance.touched).toBe(false); expect(focusedChange).toHaveBeenCalled(); }); it(`id`, () => { - expect(controlInstance.nativeId).toEqual(``); + expect(controlInstance.nativeId).toBe(``); expect(controlInstance.id.startsWith(`tui_interactive_`)).toBeTruthy(); }); it(`setup value`, () => { - expect(controlInstance.value).toEqual(`fallback`); - expect(controlInstance.safeCurrentValue).toEqual(`fallback`); + expect(controlInstance.value).toBe(`fallback`); + expect(controlInstance.safeCurrentValue).toBe(`fallback`); controlInstance.value = `5`; - expect(controlInstance.value).toEqual(`5`); - expect(controlInstance.safeCurrentValue).toEqual(`fallback`); + expect(controlInstance.value).toBe(`5`); + expect(controlInstance.safeCurrentValue).toBe(`fallback`); controlInstance.writeValue(null); - expect(controlInstance.value).toEqual(`fallback`); - expect(controlInstance.safeCurrentValue).toEqual(`fallback`); + expect(controlInstance.value).toBe(`fallback`); + expect(controlInstance.safeCurrentValue).toBe(`fallback`); controlInstance.writeValue(``); - expect(controlInstance.value).toEqual(``); - expect(controlInstance.safeCurrentValue).toEqual(`fallback`); + expect(controlInstance.value).toBe(``); + expect(controlInstance.safeCurrentValue).toBe(`fallback`); }); it(`lifecycle`, () => { - expect(controlInstance.ngOnInitTick).toEqual(true); - expect(controlInstance.ngOnDestroyTick).toEqual(false); + expect(controlInstance.ngOnInitTick).toBe(true); + expect(controlInstance.ngOnDestroyTick).toBe(false); testComponent.enabled = false; fixture.detectChanges(); - expect(controlInstance.ngOnDestroyTick).toEqual(true); + expect(controlInstance.ngOnDestroyTick).toBe(true); expect(testComponent.myControl).toBeUndefined(); }); @@ -224,12 +224,12 @@ describe(`AbstractTuiControl and NgControl not injected in MyControlComponent`, it(`setDisabledState`, () => { expect(markForCheckSpy).not.toHaveBeenCalled(); - expect(controlInstance.disabled).toEqual(false); + expect(controlInstance.disabled).toBe(false); controlInstance.setDisabledState(); expect(markForCheckSpy).toHaveBeenCalled(); - expect(controlInstance.disabled).toEqual(false); + expect(controlInstance.disabled).toBe(false); }); }); }); diff --git a/projects/cdk/abstract/tests/abstract-control-with-control.spec.ts b/projects/cdk/abstract/tests/abstract-control-with-control.spec.ts index a80eaa34529e..4ecbc2cea0f4 100644 --- a/projects/cdk/abstract/tests/abstract-control-with-control.spec.ts +++ b/projects/cdk/abstract/tests/abstract-control-with-control.spec.ts @@ -105,87 +105,87 @@ describe(`AbstractTuiControl and FormControl`, () => { it(`default behaviour`, () => { expect(controlInstance).toBeTruthy(); expect(controlInstance.child.parent).toBeInstanceOf(MyControlComponent); - expect(controlInstance.readOnly).toEqual(false); - expect(controlInstance.nativeId).toEqual(``); - - expect(controlInstance.getTransformers()).toEqual(null); - expect(controlInstance.value).toEqual(`Hello`); - expect(controlInstance.safeCurrentValue).toEqual(`Hello`); - expect(controlInstance.invalid).toEqual(false); - expect(controlInstance.valid).toEqual(true); - expect(controlInstance.touched).toEqual(false); - expect(controlInstance.disabled).toEqual(false); - expect(controlInstance.interactive).toEqual(true); + expect(controlInstance.readOnly).toBe(false); + expect(controlInstance.nativeId).toBe(``); + + expect(controlInstance.getTransformers()).toBeNull(); + expect(controlInstance.value).toBe(`Hello`); + expect(controlInstance.safeCurrentValue).toBe(`Hello`); + expect(controlInstance.invalid).toBe(false); + expect(controlInstance.valid).toBe(true); + expect(controlInstance.touched).toBe(false); + expect(controlInstance.disabled).toBe(false); + expect(controlInstance.interactive).toBe(true); expect(controlInstance.control).toBeInstanceOf(FormControl); }); it(`pseudo`, () => { - expect(controlInstance.pseudoFocus).toEqual(null); - expect(controlInstance.pseudoHover).toEqual(null); - expect(controlInstance.pseudoActive).toEqual(null); - expect(controlInstance.pseudoInvalid).toEqual(null); + expect(controlInstance.pseudoFocus).toBeNull(); + expect(controlInstance.pseudoHover).toBeNull(); + expect(controlInstance.pseudoActive).toBeNull(); + expect(controlInstance.pseudoInvalid).toBeNull(); }); it(`computed`, () => { - expect(controlInstance.computedName).toEqual(null); - expect(controlInstance.computedDisabled).toEqual(false); - expect(controlInstance.computedInvalid).toEqual(false); - expect(controlInstance.computedFocusable).toEqual(true); - expect(controlInstance.computedFocusVisible).toEqual(false); - expect(controlInstance.computedFocused).toEqual(false); + expect(controlInstance.computedName).toBeNull(); + expect(controlInstance.computedDisabled).toBe(false); + expect(controlInstance.computedInvalid).toBe(false); + expect(controlInstance.computedFocusable).toBe(true); + expect(controlInstance.computedFocusVisible).toBe(false); + expect(controlInstance.computedFocused).toBe(false); controlInstance.pseudoFocus = true; controlInstance.pseudoHover = true; controlInstance.pseudoActive = true; - expect(controlInstance.computedFocusable).toEqual(true); - expect(controlInstance.computedFocusVisible).toEqual(true); - expect(controlInstance.computedFocused).toEqual(true); + expect(controlInstance.computedFocusable).toBe(true); + expect(controlInstance.computedFocusVisible).toBe(true); + expect(controlInstance.computedFocused).toBe(true); }); it(`focusable`, () => { const focusedChange = jest.spyOn(controlInstance.focusedChange, `emit`); - expect(controlInstance.focused).toEqual(false); - expect(controlInstance.focusable).toEqual(true); - expect(controlInstance.touched).toEqual(false); + expect(controlInstance.focused).toBe(false); + expect(controlInstance.focusable).toBe(true); + expect(controlInstance.touched).toBe(false); expect(focusedChange).not.toHaveBeenCalled(); controlInstance.forceUpdateFocused(true); - expect(controlInstance.focused).toEqual(true); - expect(controlInstance.focusable).toEqual(true); - expect(controlInstance.touched).toEqual(false); + expect(controlInstance.focused).toBe(true); + expect(controlInstance.focusable).toBe(true); + expect(controlInstance.touched).toBe(false); expect(focusedChange).toHaveBeenCalled(); controlInstance.forceUpdateFocused(false); - expect(controlInstance.focused).toEqual(false); - expect(controlInstance.focusable).toEqual(true); - expect(controlInstance.touched).toEqual(true); + expect(controlInstance.focused).toBe(false); + expect(controlInstance.focusable).toBe(true); + expect(controlInstance.touched).toBe(true); expect(focusedChange).toHaveBeenCalled(); }); it(`id`, () => { - expect(controlInstance.nativeId).toEqual(``); + expect(controlInstance.nativeId).toBe(``); expect(controlInstance.id.startsWith(`tui_interactive_`)).toBeTruthy(); }); it(`setup value`, () => { - expect(controlInstance.value).toEqual(`Hello`); - expect(controlInstance.safeCurrentValue).toEqual(`Hello`); + expect(controlInstance.value).toBe(`Hello`); + expect(controlInstance.safeCurrentValue).toBe(`Hello`); controlInstance.value = `5`; - expect(controlInstance.value).toEqual(`5`); - expect(controlInstance.safeCurrentValue).toEqual(`5`); + expect(controlInstance.value).toBe(`5`); + expect(controlInstance.safeCurrentValue).toBe(`5`); controlInstance.writeValue(null); - expect(controlInstance.value).toEqual(`fallback`); - expect(controlInstance.safeCurrentValue).toEqual(`5`); + expect(controlInstance.value).toBe(`fallback`); + expect(controlInstance.safeCurrentValue).toBe(`5`); controlInstance.writeValue(``); - expect(controlInstance.value).toEqual(``); - expect(controlInstance.safeCurrentValue).toEqual(`5`); + expect(controlInstance.value).toBe(``); + expect(controlInstance.safeCurrentValue).toBe(`5`); }); describe(`change detection`, () => { @@ -212,12 +212,12 @@ describe(`AbstractTuiControl and FormControl`, () => { it(`setDisabledState`, () => { expect(markForCheckSpy).not.toHaveBeenCalled(); - expect(controlInstance.disabled).toEqual(false); + expect(controlInstance.disabled).toBe(false); controlInstance.setDisabledState(); expect(markForCheckSpy).toHaveBeenCalled(); - expect(controlInstance.disabled).toEqual(false); + expect(controlInstance.disabled).toBe(false); }); }); }); diff --git a/projects/cdk/abstract/tests/abstract-tui-controller.spec.ts b/projects/cdk/abstract/tests/abstract-tui-controller.spec.ts index 13217699223d..1d7ff94bf00f 100644 --- a/projects/cdk/abstract/tests/abstract-tui-controller.spec.ts +++ b/projects/cdk/abstract/tests/abstract-tui-controller.spec.ts @@ -48,6 +48,6 @@ describe(`AbstractTuiController`, () => { expect(changeSpy).toHaveBeenCalled(); - expect(fixture.componentInstance.element.message).toEqual(`world`); + expect(fixture.componentInstance.element.message).toBe(`world`); }); }); diff --git a/projects/cdk/components/dropdown-host/test/dropdown-portal.service.spec.ts b/projects/cdk/components/dropdown-host/test/dropdown-portal.service.spec.ts index b54f89586715..86997e4c3cff 100644 --- a/projects/cdk/components/dropdown-host/test/dropdown-portal.service.spec.ts +++ b/projects/cdk/components/dropdown-host/test/dropdown-portal.service.spec.ts @@ -19,7 +19,7 @@ describe(`PortalService`, () => { } as unknown as EmbeddedViewRef; service.removeTemplate(viewRefStub); - expect(called).toEqual(1); + expect(called).toBe(1); }); it(`HostView removing`, () => { @@ -29,7 +29,7 @@ describe(`PortalService`, () => { } as unknown as ComponentRef; service.remove(componentRefStub); - expect(called).toEqual(1); + expect(called).toBe(1); }); describe(`production mode`, () => { @@ -43,7 +43,7 @@ describe(`PortalService`, () => { actual = err.message; } - expect(actual).toEqual(``); + expect(actual).toBe(``); }); }); @@ -60,9 +60,7 @@ describe(`PortalService`, () => { actual = err.message; } - expect(actual).toEqual( - `Portals cannot be used without TuiPortalHostComponent`, - ); + expect(actual).toBe(`Portals cannot be used without TuiPortalHostComponent`); }); afterEach(() => tuiSwitchNgDevMode(false)); diff --git a/projects/cdk/date-time/test/day.spec.ts b/projects/cdk/date-time/test/day.spec.ts index bfdeea059a89..5742600041d4 100644 --- a/projects/cdk/date-time/test/day.spec.ts +++ b/projects/cdk/date-time/test/day.spec.ts @@ -944,8 +944,8 @@ describe(`TuiDay`, () => { it(`the primitive value of a TuiDay object`, () => { const day = new TuiDay(2000, 5, 13); - expect(typeof Number(day)).toEqual(`number`); - expect(typeof day.valueOf()).toEqual(`number`); + expect(typeof Number(day)).toBe(`number`); + expect(typeof day.valueOf()).toBe(`number`); expect(day > new TuiDay(2000, 5, 10)).toBeTruthy(); expect(day < new TuiDay(2001, 5, 10)).toBeTruthy(); }); @@ -955,24 +955,24 @@ describe(`TuiDay`, () => { it(`a number if the hint is number`, () => { const day = new TuiDay(2009, 2, 28); - expect(typeof Number(day)).toEqual(`number`); - expect(typeof day.valueOf()).toEqual(`number`); - expect(typeof day[Symbol.toPrimitive](`number`)).toEqual(`number`); + expect(typeof Number(day)).toBe(`number`); + expect(typeof day.valueOf()).toBe(`number`); + expect(typeof day[Symbol.toPrimitive](`number`)).toBe(`number`); }); it(`a string if the hint is string`, () => { const day = new TuiDay(2004, 3, 22); - expect(typeof String(day)).toEqual(`string`); - expect(typeof day.toString()).toEqual(`string`); - expect(typeof day[Symbol.toPrimitive](`string`)).toEqual(`string`); + expect(typeof String(day)).toBe(`string`); + expect(typeof day.toString()).toBe(`string`); + expect(typeof day[Symbol.toPrimitive](`string`)).toBe(`string`); }); it(`a string if the hint is default`, () => { const day = new TuiDay(2012, 7, 18); - expect(typeof `${day}`).toEqual(`string`); - expect(typeof day[Symbol.toPrimitive](`default`)).toEqual(`string`); + expect(typeof `${day}`).toBe(`string`); + expect(typeof day[Symbol.toPrimitive](`default`)).toBe(`string`); }); }); }); diff --git a/projects/cdk/date-time/test/month.spec.ts b/projects/cdk/date-time/test/month.spec.ts index 845900c05608..36375c65eb9d 100644 --- a/projects/cdk/date-time/test/month.spec.ts +++ b/projects/cdk/date-time/test/month.spec.ts @@ -547,8 +547,8 @@ describe(`TuiMonth`, () => { it(`the primitive value of a TuiMonth object`, () => { const month = new TuiMonth(2000, 5); - expect(typeof Number(month)).toEqual(`number`); - expect(typeof month.valueOf()).toEqual(`number`); + expect(typeof Number(month)).toBe(`number`); + expect(typeof month.valueOf()).toBe(`number`); expect(month > new TuiMonth(2000, 4)).toBeTruthy(); expect(month < new TuiMonth(2001, 6)).toBeTruthy(); }); @@ -558,24 +558,24 @@ describe(`TuiMonth`, () => { it(`a number if the hint is number`, () => { const month = new TuiMonth(1998, 7); - expect(typeof Number(month)).toEqual(`number`); - expect(typeof month.valueOf()).toEqual(`number`); - expect(typeof month[Symbol.toPrimitive](`number`)).toEqual(`number`); + expect(typeof Number(month)).toBe(`number`); + expect(typeof month.valueOf()).toBe(`number`); + expect(typeof month[Symbol.toPrimitive](`number`)).toBe(`number`); }); it(`a string if the hint is string`, () => { const month = new TuiMonth(2030, 1); - expect(typeof String(month)).toEqual(`string`); - expect(typeof month.toString()).toEqual(`string`); - expect(typeof month[Symbol.toPrimitive](`string`)).toEqual(`string`); + expect(typeof String(month)).toBe(`string`); + expect(typeof month.toString()).toBe(`string`); + expect(typeof month[Symbol.toPrimitive](`string`)).toBe(`string`); }); it(`a string if the hint is default`, () => { const month = new TuiMonth(1905, 2); - expect(typeof `${month}`).toEqual(`string`); - expect(typeof month[Symbol.toPrimitive](`default`)).toEqual(`string`); + expect(typeof `${month}`).toBe(`string`); + expect(typeof month[Symbol.toPrimitive](`default`)).toBe(`string`); }); }); }); diff --git a/projects/cdk/date-time/test/time.spec.ts b/projects/cdk/date-time/test/time.spec.ts index c4537c5f8c54..a1433e6a3fe6 100644 --- a/projects/cdk/date-time/test/time.spec.ts +++ b/projects/cdk/date-time/test/time.spec.ts @@ -356,8 +356,8 @@ describe(`TuiTime`, () => { it(`the primitive value of TuiTime`, () => { const time = new TuiTime(6, 36, 0, 0); - expect(typeof Number(time)).toEqual(`number`); - expect(typeof time.valueOf()).toEqual(`number`); + expect(typeof Number(time)).toBe(`number`); + expect(typeof time.valueOf()).toBe(`number`); expect(time > new TuiTime(5, 30, 0, 0)).toBeTruthy(); expect(time < new TuiTime(7, 36, 0, 0)).toBeTruthy(); }); @@ -367,24 +367,24 @@ describe(`TuiTime`, () => { it(`a number if the hint is number`, () => { const time = new TuiTime(10, 36, 5, 0); - expect(typeof Number(time)).toEqual(`number`); - expect(typeof time.valueOf()).toEqual(`number`); - expect(typeof time[Symbol.toPrimitive](`number`)).toEqual(`number`); + expect(typeof Number(time)).toBe(`number`); + expect(typeof time.valueOf()).toBe(`number`); + expect(typeof time[Symbol.toPrimitive](`number`)).toBe(`number`); }); it(`a string if the hint is string`, () => { const time = new TuiTime(1, 12, 5, 10); - expect(typeof String(time)).toEqual(`string`); - expect(typeof time.toString()).toEqual(`string`); - expect(typeof time[Symbol.toPrimitive](`string`)).toEqual(`string`); + expect(typeof String(time)).toBe(`string`); + expect(typeof time.toString()).toBe(`string`); + expect(typeof time[Symbol.toPrimitive](`string`)).toBe(`string`); }); it(`a string if the hint is default`, () => { const time = new TuiTime(15, 54, 0, 0); - expect(typeof `${time}`).toEqual(`string`); - expect(typeof time[Symbol.toPrimitive](`default`)).toEqual(`string`); + expect(typeof `${time}`).toBe(`string`); + expect(typeof time[Symbol.toPrimitive](`default`)).toBe(`string`); }); }); }); diff --git a/projects/cdk/date-time/test/year.spec.ts b/projects/cdk/date-time/test/year.spec.ts index fd295421e44a..b8e1f7a10d30 100644 --- a/projects/cdk/date-time/test/year.spec.ts +++ b/projects/cdk/date-time/test/year.spec.ts @@ -459,8 +459,8 @@ describe(`TuiYear`, () => { it(`the primitive value of a TuiYear object`, () => { const year = new TuiYear(2000); - expect(typeof Number(year)).toEqual(`number`); - expect(typeof year.valueOf()).toEqual(`number`); + expect(typeof Number(year)).toBe(`number`); + expect(typeof year.valueOf()).toBe(`number`); expect(year > new TuiYear(1999)).toBeTruthy(); expect(year < new TuiYear(2001)).toBeTruthy(); }); @@ -470,24 +470,24 @@ describe(`TuiYear`, () => { it(`a number if the hint is number`, () => { const year = new TuiYear(1701); - expect(typeof Number(year)).toEqual(`number`); - expect(typeof year.valueOf()).toEqual(`number`); - expect(typeof year[Symbol.toPrimitive](`number`)).toEqual(`number`); + expect(typeof Number(year)).toBe(`number`); + expect(typeof year.valueOf()).toBe(`number`); + expect(typeof year[Symbol.toPrimitive](`number`)).toBe(`number`); }); it(`a string if the hint is string`, () => { const year = new TuiYear(2201); - expect(typeof String(year)).toEqual(`string`); - expect(typeof year.toString()).toEqual(`string`); - expect(typeof year[Symbol.toPrimitive](`string`)).toEqual(`string`); + expect(typeof String(year)).toBe(`string`); + expect(typeof year.toString()).toBe(`string`); + expect(typeof year[Symbol.toPrimitive](`string`)).toBe(`string`); }); it(`a string if the hint is default`, () => { const year = new TuiYear(2002); - expect(typeof `${year}`).toEqual(`string`); - expect(typeof year[Symbol.toPrimitive](`default`)).toEqual(`string`); + expect(typeof `${year}`).toBe(`string`); + expect(typeof year[Symbol.toPrimitive](`default`)).toBe(`string`); }); }); }); diff --git a/projects/cdk/decorators/test/debounce.spec.ts b/projects/cdk/decorators/test/debounce.spec.ts index c3d9b1311448..4b16fb5f814d 100644 --- a/projects/cdk/decorators/test/debounce.spec.ts +++ b/projects/cdk/decorators/test/debounce.spec.ts @@ -13,20 +13,20 @@ describe(`tuiDebounce`, () => { const instance = new MyClass(); - expect(instance.count).toEqual(0); + expect(instance.count).toBe(0); instance.method(); instance.method(); instance.method(); - expect(instance.count).toEqual(0); + expect(instance.count).toBe(0); setTimeout(() => instance.method(), 50); - expect(instance.count).toEqual(0); + expect(instance.count).toBe(0); setTimeout(() => { - expect(instance.count).toEqual(1); + expect(instance.count).toBe(1); done(); }, 200); diff --git a/projects/cdk/decorators/test/default-prop-and-pure.spec.ts b/projects/cdk/decorators/test/default-prop-and-pure.spec.ts index cddc3f2994e8..31b7fa980f10 100644 --- a/projects/cdk/decorators/test/default-prop-and-pure.spec.ts +++ b/projects/cdk/decorators/test/default-prop-and-pure.spec.ts @@ -47,12 +47,12 @@ describe(`@tuiDefaultProp and @tuiPure`, () => { } } - expect(new A(`_A_`).limitWidth).toEqual(`__B`); - expect(new B(`_B_`).limitWidth).toEqual(`__B`); - expect(new C(`_C_`).limitWidth).toEqual(`_C_`); + expect(new A(`_A_`).limitWidth).toBe(`__B`); + expect(new B(`_B_`).limitWidth).toBe(`__B`); + expect(new C(`_C_`).limitWidth).toBe(`_C_`); - expect(new A(`_A_`).update(`A`).width).toEqual(`A`); - expect(new B(`_B_`).update(`B`).width).toEqual(`B`); - expect(new C(`_C_`).width).toEqual(`_C_`); + expect(new A(`_A_`).update(`A`).width).toBe(`A`); + expect(new B(`_B_`).update(`B`).width).toBe(`B`); + expect(new C(`_C_`).width).toBe(`_C_`); }); }); diff --git a/projects/cdk/decorators/test/pure.spec.ts b/projects/cdk/decorators/test/pure.spec.ts index 57be39ebf229..16616fc0d635 100644 --- a/projects/cdk/decorators/test/pure.spec.ts +++ b/projects/cdk/decorators/test/pure.spec.ts @@ -82,7 +82,7 @@ describe(`tuiPure`, () => { expect(testObject.range).toEqual([1, 2, 3, 4, 5]); expect(testObject.range).toEqual([1, 2, 3, 4, 5]); expect(testObject.range).toEqual([1, 2, 3, 4, 5]); - expect(testObject.sideEffect).toEqual(1); + expect(testObject.sideEffect).toBe(1); }); it(`memoize function without arguments and return undefined by default`, () => { @@ -100,9 +100,9 @@ describe(`tuiPure`, () => { const testObject = new TestClass(); - expect(testObject.voidFn()).toEqual(undefined); - expect(testObject.voidFn()).toEqual(undefined); - expect(testObject.voidFn()).toEqual(undefined); - expect(testObject.sideEffect).toEqual(1); + expect(testObject.voidFn()).toBeUndefined(); + expect(testObject.voidFn()).toBeUndefined(); + expect(testObject.voidFn()).toBeUndefined(); + expect(testObject.sideEffect).toBe(1); }); }); diff --git a/projects/cdk/directives/active-zone/tests/active-zone.directive.spec.ts b/projects/cdk/directives/active-zone/tests/active-zone.directive.spec.ts index 27ffc2521fb9..bbbc604a6c7c 100644 --- a/projects/cdk/directives/active-zone/tests/active-zone.directive.spec.ts +++ b/projects/cdk/directives/active-zone/tests/active-zone.directive.spec.ts @@ -113,42 +113,42 @@ describe(`TuiActiveZoneDirective`, () => { }); it(`initial composite zone`, () => { - expect(getZoneInfo(`#parent-info`)).toEqual(`Parent zone: false`); - expect(getZoneInfo(`#child-info`)).toEqual(`Child zone: false`); + expect(getZoneInfo(`#parent-info`)).toBe(`Parent zone: false`); + expect(getZoneInfo(`#child-info`)).toBe(`Child zone: false`); }); it(`mark parent zone when click on button inside zone`, () => { el.querySelector(`#button-inside-zone`)?.focus(); - expect(getZoneInfo(`#parent-info`)).toEqual(`Parent zone: true`); - expect(getZoneInfo(`#child-info`)).toEqual(`Child zone: false`); + expect(getZoneInfo(`#parent-info`)).toBe(`Parent zone: true`); + expect(getZoneInfo(`#child-info`)).toBe(`Child zone: false`); }); it(`mark parent and child zone when focus on input inside zone`, () => { el.querySelector(`#input-inside-zone`)?.focus(); - expect(getZoneInfo(`#parent-info`)).toEqual(`Parent zone: true`); - expect(getZoneInfo(`#child-info`)).toEqual(`Child zone: true`); + expect(getZoneInfo(`#parent-info`)).toBe(`Parent zone: true`); + expect(getZoneInfo(`#child-info`)).toBe(`Child zone: true`); }); it(`manual mark parent and child zone`, () => { el.querySelector(`#focus-input-inside`)?.click(); - expect(getZoneInfo(`#parent-info`)).toEqual(`Parent zone: true`); - expect(getZoneInfo(`#child-info`)).toEqual(`Child zone: true`); + expect(getZoneInfo(`#parent-info`)).toBe(`Parent zone: true`); + expect(getZoneInfo(`#child-info`)).toBe(`Child zone: true`); }); it(`not affected when focus input outside zone`, () => { el.querySelector(`#input-outside-zone`)?.focus(); - expect(getZoneInfo(`#parent-info`)).toEqual(`Parent zone: false`); - expect(getZoneInfo(`#child-info`)).toEqual(`Child zone: false`); + expect(getZoneInfo(`#parent-info`)).toBe(`Parent zone: false`); + expect(getZoneInfo(`#child-info`)).toBe(`Child zone: false`); }); it(`not affected when click button outside zone`, () => { el.querySelector(`#button-outside-zone`)?.focus(); - expect(getZoneInfo(`#parent-info`)).toEqual(`Parent zone: false`); - expect(getZoneInfo(`#child-info`)).toEqual(`Child zone: false`); + expect(getZoneInfo(`#parent-info`)).toBe(`Parent zone: false`); + expect(getZoneInfo(`#child-info`)).toBe(`Child zone: false`); }); }); diff --git a/projects/cdk/directives/droppable/test/droppable.directive.spec.ts b/projects/cdk/directives/droppable/test/droppable.directive.spec.ts index 6fb456f5af8f..4c047e69b4b9 100644 --- a/projects/cdk/directives/droppable/test/droppable.directive.spec.ts +++ b/projects/cdk/directives/droppable/test/droppable.directive.spec.ts @@ -45,7 +45,7 @@ describe(`TuiDroppable Directive`, () => { const dataTransfer = new DataTransfer(); const event = new TuiMockEvent(`drop`, {dataTransfer}); - event.preventDefault = jest.fn(); + jest.spyOn(event, `preventDefault`).mockImplementation(); directiveElement.dispatchEvent(event); expect(event.preventDefault).toHaveBeenCalled(); @@ -54,7 +54,7 @@ describe(`TuiDroppable Directive`, () => { it(`DragOver event is prevented`, () => { const event = new Event(`dragover`); - event.preventDefault = jest.fn(); + jest.spyOn(event, `preventDefault`).mockImplementation(); directiveElement.dispatchEvent(event); expect(event.preventDefault).toHaveBeenCalled(); diff --git a/projects/cdk/directives/zoom/test/zoom.directive.spec.ts b/projects/cdk/directives/zoom/test/zoom.directive.spec.ts index 3300a8b83c6c..56f25efa92a8 100644 --- a/projects/cdk/directives/zoom/test/zoom.directive.spec.ts +++ b/projects/cdk/directives/zoom/test/zoom.directive.spec.ts @@ -48,7 +48,7 @@ xdescribe(`TuiZoom directive`, () => { fixture.detectChanges(); - expect(tuiFloor(testComponent.scale, 2)).toEqual(0.85); + expect(tuiFloor(testComponent.scale, 2)).toBe(0.85); }); it(`wheel`, () => { @@ -58,7 +58,7 @@ xdescribe(`TuiZoom directive`, () => { fixture.detectChanges(); - expect(tuiFloor(testComponent.scale, 2)).toEqual(1.01); + expect(tuiFloor(testComponent.scale, 2)).toBe(1.01); }); function sendTouchEvent( diff --git a/projects/cdk/observables/test/control-value.spec.ts b/projects/cdk/observables/test/control-value.spec.ts index 96a180dfccf3..cdfd7ddf2445 100644 --- a/projects/cdk/observables/test/control-value.spec.ts +++ b/projects/cdk/observables/test/control-value.spec.ts @@ -13,7 +13,7 @@ describe(`tuiControlValue`, () => { actual = value; }); - expect(actual).toEqual(`hello`); + expect(actual).toBe(`hello`); })); it(`takes control and emits its values`, fakeAsync(() => { diff --git a/projects/cdk/pipes/mapper/test/mapper.pipe.spec.ts b/projects/cdk/pipes/mapper/test/mapper.pipe.spec.ts index 05990510c5f5..4e34ed9b6151 100644 --- a/projects/cdk/pipes/mapper/test/mapper.pipe.spec.ts +++ b/projects/cdk/pipes/mapper/test/mapper.pipe.spec.ts @@ -16,6 +16,6 @@ describe(`TuiMapper pipe`, () => { }); it(`Works with extra arguments`, () => { - expect(pipe.transform(data, mapper, ...args)).toEqual(`TESTthree eleven`); + expect(pipe.transform(data, mapper, ...args)).toBe(`TESTthree eleven`); }); }); diff --git a/projects/cdk/pipes/replace/test/replace.pipe.spec.ts b/projects/cdk/pipes/replace/test/replace.pipe.spec.ts index bc4814350f0b..fb14ff69795e 100644 --- a/projects/cdk/pipes/replace/test/replace.pipe.spec.ts +++ b/projects/cdk/pipes/replace/test/replace.pipe.spec.ts @@ -10,25 +10,25 @@ describe(`TuiReplacePipe`, () => { it(`should return the replaced string`, () => { const result = pipe.transform(`Hello`, `Hello`, `World`); - expect(result).toEqual(`World`); + expect(result).toBe(`World`); }); it(`regex`, () => { const result = pipe.transform(`111222333`, /1/g, `b`); - expect(result).toEqual(`bbb222333`); + expect(result).toBe(`bbb222333`); }); it(`function`, () => { const result = pipe.transform(`abcdeabcde`, /a/g, () => `f`); - expect(result).toEqual(`fbcdefbcde`); + expect(result).toBe(`fbcdefbcde`); }); it(`unchanged`, () => { - expect(pipe.transform(`abc`, ``, ``)).toEqual(`abc`); - expect(pipe.transform(``, ``, ``)).toEqual(``); - expect(pipe.transform(null, ``, ``)).toEqual(``); - expect(pipe.transform(undefined, ``, ``)).toEqual(``); + expect(pipe.transform(`abc`, ``, ``)).toBe(`abc`); + expect(pipe.transform(``, ``, ``)).toBe(``); + expect(pipe.transform(null, ``, ``)).toBe(``); + expect(pipe.transform(undefined, ``, ``)).toBe(``); }); }); diff --git a/projects/cdk/schematics/ng-add/tests/schematic-ng-add-standalone.spec.ts b/projects/cdk/schematics/ng-add/tests/schematic-ng-add-standalone.spec.ts index f168a5e6ffb6..f9efaba09b52 100644 --- a/projects/cdk/schematics/ng-add/tests/schematic-ng-add-standalone.spec.ts +++ b/projects/cdk/schematics/ng-add/tests/schematic-ng-add-standalone.spec.ts @@ -53,7 +53,7 @@ describe(`ng-add [Standalone]`, () => { const tree = await runner.runSchematicAsync(`ng-add`, options, host).toPromise(); - expect(tree.readContent(`package.json`)).toEqual( + expect(tree.readContent(`package.json`)).toBe( `{ "dependencies": { "@angular/core": "~13.0.0", @@ -79,7 +79,7 @@ describe(`ng-add [Standalone]`, () => { const tree = await runner.runSchematicAsync(`ng-add`, options, host).toPromise(); - expect(tree.readContent(`package.json`)).toEqual( + expect(tree.readContent(`package.json`)).toBe( `{ "devDependencies": { "@types/dompurify": "${DOMPURIFY_TYPES_VERSION}" @@ -113,7 +113,7 @@ describe(`ng-add [Standalone]`, () => { const tree = await runner.runSchematicAsync(`ng-add`, options, host).toPromise(); - expect(tree.readContent(`package.json`)).toEqual( + expect(tree.readContent(`package.json`)).toBe( `{ "devDependencies": { "@types/dompurify": "${DOMPURIFY_TYPES_VERSION}" @@ -144,7 +144,7 @@ describe(`ng-add [Standalone]`, () => { ) .toPromise(); - expect(tree.readContent(`angular.json`)).toEqual(` + expect(tree.readContent(`angular.json`)).toBe(` { "version": 1, "defaultProject": "demo", @@ -185,7 +185,7 @@ describe(`ng-add [Standalone]`, () => { ) .toPromise(); - expect(tree.readContent(`angular.json`)).toEqual(` + expect(tree.readContent(`angular.json`)).toBe(` { "version": 1, "defaultProject": "demo", @@ -227,7 +227,7 @@ describe(`ng-add [Standalone]`, () => { ) .toPromise(); - expect(tree.readContent(`angular.json`)).toEqual(` + expect(tree.readContent(`angular.json`)).toBe(` { "version": 1, "defaultProject": "demo", @@ -273,7 +273,7 @@ describe(`ng-add [Standalone]`, () => { .runSchematicAsync(`ng-add-setup-project`, options, host) .toPromise(); - expect(tree.readContent(`test/app/app.component.ts`)).toEqual( + expect(tree.readContent(`test/app/app.component.ts`)).toBe( `import { NgDompurifySanitizer } from "@tinkoff/ng-dompurify"; import { TuiRootModule, TuiDialogModule, TuiAlertModule, TUI_SANITIZER } from "@taiga-ui/core"; import { Component } from '@angular/core'; @@ -302,7 +302,7 @@ export class AppComponent { ) .toPromise(); - expect(tree.readContent(`test/app/app.template.html`)).toEqual(` + expect(tree.readContent(`test/app/app.template.html`)).toBe(` `); }); @@ -317,7 +317,7 @@ export class AppComponent { .toPromise(); expect(tree.readContent(`test/main.ts`)) - .toEqual(`import { importProvidersFrom } from "@angular/core"; + .toBe(`import { importProvidersFrom } from "@angular/core"; import { TuiRootModule } from "@taiga-ui/core"; import { bootstrapApplication } from '@angular/platform-browser'; import { @@ -347,7 +347,7 @@ bootstrapApplication(AppComponent, { .toPromise(); expect(tree.readContent(`test/app/app.config.ts`)) - .toEqual(`import { TuiRootModule } from "@taiga-ui/core"; + .toBe(`import { TuiRootModule } from "@taiga-ui/core"; import { ApplicationConfig, importProvidersFrom } from '@angular/core'; import { @@ -375,7 +375,7 @@ export const appConfig: ApplicationConfig = { .toPromise(); expect(tree.readContent(`test/main.ts`)) - .toEqual(`import { importProvidersFrom } from "@angular/core"; + .toBe(`import { importProvidersFrom } from "@angular/core"; import { providerAnimation } from "@angular/platform-browser/animations"; import { TuiRootModule } from "@taiga-ui/core"; import { bootstrapApplication } from '@angular/platform-browser'; diff --git a/projects/cdk/schematics/ng-add/tests/schematic-ng-add.spec.ts b/projects/cdk/schematics/ng-add/tests/schematic-ng-add.spec.ts index c8814fed9959..aea4de27ab4e 100644 --- a/projects/cdk/schematics/ng-add/tests/schematic-ng-add.spec.ts +++ b/projects/cdk/schematics/ng-add/tests/schematic-ng-add.spec.ts @@ -53,7 +53,7 @@ describe(`ng-add`, () => { const tree = await runner.runSchematicAsync(`ng-add`, options, host).toPromise(); - expect(tree.readContent(`package.json`)).toEqual( + expect(tree.readContent(`package.json`)).toBe( `{ "dependencies": { "@angular/core": "~13.0.0", @@ -79,7 +79,7 @@ describe(`ng-add`, () => { const tree = await runner.runSchematicAsync(`ng-add`, options, host).toPromise(); - expect(tree.readContent(`package.json`)).toEqual( + expect(tree.readContent(`package.json`)).toBe( `{ "devDependencies": { "@types/dompurify": "${DOMPURIFY_TYPES_VERSION}" @@ -113,7 +113,7 @@ describe(`ng-add`, () => { const tree = await runner.runSchematicAsync(`ng-add`, options, host).toPromise(); - expect(tree.readContent(`package.json`)).toEqual( + expect(tree.readContent(`package.json`)).toBe( `{ "devDependencies": { "@types/dompurify": "${DOMPURIFY_TYPES_VERSION}" @@ -144,7 +144,7 @@ describe(`ng-add`, () => { ) .toPromise(); - expect(tree.readContent(`angular.json`)).toEqual(` + expect(tree.readContent(`angular.json`)).toBe(` { "version": 1, "defaultProject": "demo", @@ -185,7 +185,7 @@ describe(`ng-add`, () => { ) .toPromise(); - expect(tree.readContent(`angular.json`)).toEqual(` + expect(tree.readContent(`angular.json`)).toBe(` { "version": 1, "defaultProject": "demo", @@ -227,7 +227,7 @@ describe(`ng-add`, () => { ) .toPromise(); - expect(tree.readContent(`angular.json`)).toEqual(` + expect(tree.readContent(`angular.json`)).toBe(` { "version": 1, "defaultProject": "demo", @@ -273,7 +273,7 @@ describe(`ng-add`, () => { .runSchematicAsync(`ng-add-setup-project`, options, host) .toPromise(); - expect(tree.readContent(`test/app/app.module.ts`)).toEqual( + expect(tree.readContent(`test/app/app.module.ts`)).toBe( `import { NgDompurifySanitizer } from "@tinkoff/ng-dompurify"; import { TuiRootModule, TuiDialogModule, TuiAlertModule, TUI_SANITIZER } from "@taiga-ui/core"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; @@ -298,7 +298,7 @@ export class AppModule {} ) .toPromise(); - expect(tree.readContent(`test/app/app.template.html`)).toEqual(` + expect(tree.readContent(`test/app/app.template.html`)).toBe(` `); }); diff --git a/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-deep-imports.spec.ts b/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-deep-imports.spec.ts index 004ef16d20a1..6d959494597f 100644 --- a/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-deep-imports.spec.ts +++ b/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-deep-imports.spec.ts @@ -40,7 +40,7 @@ describe(`ng-update`, () => { ) .toPromise(); - expect(tree.readContent(`test/app/app.component.ts`)).toEqual( + expect(tree.readContent(`test/app/app.component.ts`)).toBe( `import { Component } from '@angular/core'; import { some } from '@taiga-ui/kit'; import { any } from '@taiga-ui/cdk' @@ -50,11 +50,11 @@ import { unknown } from '@taiga-ui/core' export class AppComponent {}`, ); - expect(tree.readContent(`test/style.less`)).toEqual( + expect(tree.readContent(`test/style.less`)).toBe( `${TUI_WARNING_NORMALIZE}\n@import '@taiga-ui/styles/taiga-ui-global.less';`, ); - expect(tree.readContent(`test/app/app.template.less`)).toEqual( + expect(tree.readContent(`test/app/app.template.less`)).toBe( `@import '@taiga-ui/core/styles/taiga-ui-local.less';`, ); }); diff --git a/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-enums.spec.ts b/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-enums.spec.ts index 2ed9c586898d..33fe20bf9ab8 100644 --- a/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-enums.spec.ts +++ b/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-enums.spec.ts @@ -39,7 +39,7 @@ describe(`ng-update`, () => { ) .toPromise(); - expect(tree.readContent(`test/app/app.component.ts`)).toEqual( + expect(tree.readContent(`test/app/app.component.ts`)).toBe( `import {Component} from '@angular/core'; import {some} from '@taiga-ui/cdk'; import {TuiLineType} from '@taiga-ui/cdk'; diff --git a/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-html.spec.ts b/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-html.spec.ts index 4e39a4a3e1e2..5ab9169703d0 100644 --- a/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-html.spec.ts +++ b/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-html.spec.ts @@ -631,7 +631,7 @@ describe(`ng-update`, () => { ) .toPromise(); - expect(tree.readContent(`angular.json`)).toEqual( + expect(tree.readContent(`angular.json`)).toBe( ` { "version": 1, diff --git a/projects/cdk/services/test/resize.service.spec.ts b/projects/cdk/services/test/resize.service.spec.ts index b0015cb3e454..4637178fb8d4 100644 --- a/projects/cdk/services/test/resize.service.spec.ts +++ b/projects/cdk/services/test/resize.service.spec.ts @@ -35,7 +35,7 @@ describe(`TuiResizeService`, () => { }); setTimeout(() => { - expect(emitCounter).toEqual(1); + expect(emitCounter).toBe(1); done(); }, 50); }); diff --git a/projects/cdk/utils/color/test/hex-to-rgba.spec.ts b/projects/cdk/utils/color/test/hex-to-rgba.spec.ts index e6d59047c9a2..63b9d49f1bde 100644 --- a/projects/cdk/utils/color/test/hex-to-rgba.spec.ts +++ b/projects/cdk/utils/color/test/hex-to-rgba.spec.ts @@ -2,9 +2,9 @@ import {tuiHexToRGBA} from '@taiga-ui/cdk'; describe(`tuiHexToRgba`, () => { it(`works`, () => { - expect(tuiHexToRGBA(`#2aed03`)).toEqual(`rgb(42, 237, 3)`); - expect(tuiHexToRGBA(`#fffffff2`)).toEqual(`rgba(255, 255, 255, 0.95)`); - expect(tuiHexToRGBA(`#fffffff6`)).toEqual(`rgba(255, 255, 255, 0.96)`); + expect(tuiHexToRGBA(`#2aed03`)).toBe(`rgb(42, 237, 3)`); + expect(tuiHexToRGBA(`#fffffff2`)).toBe(`rgba(255, 255, 255, 0.95)`); + expect(tuiHexToRGBA(`#fffffff6`)).toBe(`rgba(255, 255, 255, 0.96)`); }); it(`doesn't work`, () => { diff --git a/projects/cdk/utils/dom/test/contains-or-after.spec.ts b/projects/cdk/utils/dom/test/contains-or-after.spec.ts index 8c597181056b..03f581b2ca38 100644 --- a/projects/cdk/utils/dom/test/contains-or-after.spec.ts +++ b/projects/cdk/utils/dom/test/contains-or-after.spec.ts @@ -7,7 +7,7 @@ describe(`tuiContainsOrAfter`, () => { parent.appendChild(child); - expect(tuiContainsOrAfter(parent, child)).toEqual(true); + expect(tuiContainsOrAfter(parent, child)).toBe(true); }); it(`Child does not contain parent`, () => { @@ -16,7 +16,7 @@ describe(`tuiContainsOrAfter`, () => { parent.appendChild(child); - expect(tuiContainsOrAfter(child, parent)).toEqual(false); + expect(tuiContainsOrAfter(child, parent)).toBe(false); }); it(`catch error`, () => { @@ -29,6 +29,6 @@ describe(`tuiContainsOrAfter`, () => { } as unknown as Node, document.createElement(`button`), ), - ).toEqual(false); + ).toBe(false); }); }); diff --git a/projects/cdk/utils/dom/test/get-clipboard-data-text.spec.ts b/projects/cdk/utils/dom/test/get-clipboard-data-text.spec.ts index 187a0bee832c..38cc6e047902 100644 --- a/projects/cdk/utils/dom/test/get-clipboard-data-text.spec.ts +++ b/projects/cdk/utils/dom/test/get-clipboard-data-text.spec.ts @@ -22,6 +22,6 @@ xdescribe(`getClipboardDataText`, () => { }, }); - expect(tuiGetClipboardDataText(event)).toEqual(`data`); + expect(tuiGetClipboardDataText(event)).toBe(`data`); }); }); diff --git a/projects/cdk/utils/dom/test/get-element-obscurers.spec.ts b/projects/cdk/utils/dom/test/get-element-obscurers.spec.ts index 2889f4858602..4ab8b413d213 100644 --- a/projects/cdk/utils/dom/test/get-element-obscurers.spec.ts +++ b/projects/cdk/utils/dom/test/get-element-obscurers.spec.ts @@ -84,7 +84,7 @@ describe(`tuiGetElementObscures`, () => { const result = tuiGetElementObscures(element); expect(result).toEqual(others); - expect(result?.length).toEqual(4); + expect(result?.length).toBe(4); expect(mockElementFromPoint).toHaveBeenCalledTimes(4); }); diff --git a/projects/cdk/utils/dom/test/get-scroll-parent.spec.ts b/projects/cdk/utils/dom/test/get-scroll-parent.spec.ts index b582e66bc5a7..fdf0cecd5c99 100644 --- a/projects/cdk/utils/dom/test/get-scroll-parent.spec.ts +++ b/projects/cdk/utils/dom/test/get-scroll-parent.spec.ts @@ -2,7 +2,7 @@ import {tuiGetScrollParent} from '@taiga-ui/cdk'; describe(`tuiGetScrollParent`, () => { it(`There is no element`, () => { - expect(tuiGetScrollParent(null)).toEqual(null); + expect(tuiGetScrollParent(null)).toBeNull(); }); it(`Should return element. Vertical is true`, () => { diff --git a/projects/cdk/utils/dom/test/is-current-target.spec.ts b/projects/cdk/utils/dom/test/is-current-target.spec.ts index c61f650fe29a..5d895bb9a4d1 100644 --- a/projects/cdk/utils/dom/test/is-current-target.spec.ts +++ b/projects/cdk/utils/dom/test/is-current-target.spec.ts @@ -7,6 +7,6 @@ describe(`isCurrentTarget`, () => { Object.defineProperty(event, `target`, {value: `