Skip to content

Commit

Permalink
chore: update lint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Jun 27, 2024
1 parent 8c9703d commit f337849
Show file tree
Hide file tree
Showing 60 changed files with 340 additions and 341 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
"plugin:@taiga-ui/experience/entry-points"
],
"rules": {
"@angular-eslint/component-class-suffix": "off",
"jest/prefer-importing-jest-globals": "off"
},
"root": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,47 +50,47 @@ describe('Axes', () => {
});

describe('axisXLabels', () => {
it('By default there are no X labels', () => {
it('by default there are no X labels', () => {
expect(testComponent.defaultValues.hasXLabels).toBe(false);
});

it('When axisXLabels is not empty, labels are shown', () => {
it('when axisXLabels is not empty, labels are shown', () => {
expect(testComponent.customValues.hasXLabels).toBe(true);
});
});

describe('axisYLabels', () => {
it('By default there are no Y labels', () => {
it('by default there are no Y labels', () => {
expect(testComponent.defaultValues.hasYLabels).toBe(false);
});

it('When axisYLabels is not empty, labels are shown', () => {
it('when axisYLabels is not empty, labels are shown', () => {
expect(testComponent.customValues.hasYLabels).toBe(true);
});

it('When axisYLabels is empty, but there is name for the axis, labels section is shown', () => {
it('when axisYLabels is empty, but there is name for the axis, labels section is shown', () => {
testComponent.axisYLabels = [];
testComponent.axisYName = 'Test';
fixture.detectChanges();

expect(testComponent.customValues.hasYLabels).toBe(true);
});

it('Empty labels falls back to non-breaking space', () => {
it('empty labels falls back to non-breaking space', () => {
expect(testComponent.defaultValues.fallback('')).toBe(CHAR_NO_BREAK_SPACE);
});
});

describe('axisYSecondaryLabels', () => {
it('By default there are no secondary Y labels', () => {
it('by default there are no secondary Y labels', () => {
expect(testComponent.defaultValues.hasYSecondaryLabels).toBe(false);
});

it('When axisYSecondaryLabels is not empty, secondary labels are shown', () => {
it('when axisYSecondaryLabels is not empty, secondary labels are shown', () => {
expect(testComponent.customValues.hasYSecondaryLabels).toBe(true);
});

it('When axisYSecondaryLabels is empty, but there is name for the secondary axis, secondary labels section is shown', () => {
it('when axisYSecondaryLabels is empty, but there is name for the secondary axis, secondary labels section is shown', () => {
testComponent.axisYSecondaryLabels = [];
testComponent.axisYSecondaryName = 'Test';
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ describe('BarChart', () => {
fixture.detectChanges();
});

it('Transposes correctly', () => {
it('transposes correctly', () => {
expect(testComponent.component.transposed).toEqual([
[1, 4],
[2, 5],
[3, 6],
]);
});

it('Computes percent correctly', () => {
it('computes percent correctly', () => {
expect(
testComponent.component.percentMapper(
[1, 3],
Expand All @@ -55,7 +55,7 @@ describe('BarChart', () => {
).toBe(50);
});

it('Computes percent correctly in collapsed mode', () => {
it('computes percent correctly in collapsed mode', () => {
testComponent.component.collapsed = true;
expect(
testComponent.component.percentMapper(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('PieChart', () => {
fixture.detectChanges();
});

it('Has segment for each item in value', () => {
it('has segment for each item in value', () => {
expect(pageObject.getAllByAutomationId('tui-pie-chart__segment').length).toBe(3);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('InputCardGrouped', () => {
fixture.autoDetectChanges();
});

it('Clear resets control to null', () => {
it('clear resets control to null', () => {
testComponent.control.setValue({
card: '123',
expire: '12/12',
Expand All @@ -68,7 +68,7 @@ describe('InputCardGrouped', () => {

describe('Card number', () => {
describe('binChange', () => {
it('Less than 6 digits entered', () => {
it('less than 6 digits entered', () => {
setCard('12345');

expect(testComponent.onBinChange).not.toHaveBeenCalled();
Expand All @@ -80,23 +80,23 @@ describe('InputCardGrouped', () => {
expect(testComponent.onBinChange).toHaveBeenCalledWith('123456');
});

it('Value has changed, first 6 digits are the same', () => {
it('value has changed, first 6 digits are the same', () => {
setCard('123456789');
(testComponent.onBinChange as Mock).mockClear();
setCard('123456987');

expect(testComponent.onBinChange).not.toHaveBeenCalled();
});

it('Value has changed, first 6 digits have changed', () => {
it('value has changed, first 6 digits have changed', () => {
setCard('123456789');
(testComponent.onBinChange as Mock).mockClear();
setCard('654321789');

expect(testComponent.onBinChange).toHaveBeenCalledWith('654321');
});

it('Value has changed, now it has less than 6 digits', () => {
it('value has changed, now it has less than 6 digits', () => {
setCard('123456789');
(testComponent.onBinChange as Mock).mockClear();
setCard('123');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@taiga-ui/addon-commerce';

describe('tuiGetCurrencyByCode', () => {
it('AED', () => {
it('aed', () => {
expect(tuiGetCurrencyByCode(TuiCurrencyCode.Dirham)).toEqual(TuiCurrency.Dirham);
expect(tuiGetCurrencyByCode(TuiCurrencyCode.Dirham)?.toString()).toBe('AED');
});
Expand Down
44 changes: 22 additions & 22 deletions projects/addon-commerce/utils/test/get-currency-symbol.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,114 +19,114 @@ describe('getCurrencySymbol', () => {
});
});

it('Ruble', () => {
it('ruble', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.Ruble)).toBe('₽');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.Ruble)).toBe('₽');
});

it('Dollar', () => {
it('dollar', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.Dollar)).toBe('$');
expect(tuiGetCurrencySymbol(TuiCurrency.MexicanPeso)).toBe('$');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.Dollar)).toBe('$');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.MexicanPeso)).toBe('$');
});

it('SingaporeDollar', () => {
it('singapore dollar', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.SingaporeDollar)).toBe('S$');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.SingaporeDollar)).toBe('S$');
});

it('AustralianDollar', () => {
it('australian dollar', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.AustralianDollar)).toBe('A$');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.AustralianDollar)).toBe('A$');
});

it('HongKongDollar', () => {
it('hongKong dollar', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.HongKongDollar)).toBe('HK$');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.HongKongDollar)).toBe('HK$');
});

it('CanadianDollar', () => {
it('canadian dollar', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.CanadianDollar)).toBe('C$');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.CanadianDollar)).toBe('C$');
});

it('Euro', () => {
it('euro', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.Euro)).toBe('€');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.Euro)).toBe('€');
});

it('Pound', () => {
it('pound', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.Pound)).toBe('£');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.Pound)).toBe('£');
});

it('Baht', () => {
it('baht', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.Baht)).toBe('฿');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.Baht)).toBe('฿');
});

it('TurkishLira', () => {
it('turkishLira', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.TurkishLira)).toBe('₺');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.TurkishLira)).toBe('₺');
});

it('YuanRenminbi', () => {
it('yuan renminbi', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.YuanRenminbi)).toBe('CN¥');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.YuanRenminbi)).toBe('CN¥');
});

it('Yen', () => {
it('yen', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.Yen)).toBe('¥');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.Yen)).toBe('¥');
});

it('IsraeliShekel', () => {
it('israeli shekel', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.IsraeliShekel)).toBe('₪');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.IsraeliShekel)).toBe('₪');
});

it('IndianRupee', () => {
it('indian rupee', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.IndianRupee)).toBe('₹');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.IndianRupee)).toBe('₹');
});

it('SwissFranc', () => {
it('swiss franc', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.SwissFranc)).toBe('₣');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.SwissFranc)).toBe('₣');
});

it('ArmenianDram', () => {
it('armenian dram', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.ArmenianDram)).toBe('֏');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.ArmenianDram)).toBe('֏');
});

it('Won', () => {
it('won', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.Won)).toBe('₩');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.Won)).toBe('₩');
});

it('Tenge', () => {
it('tenge', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.Tenge)).toBe('₸');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.Tenge)).toBe('₸');
});

it('Hryvnia', () => {
it('hryvnia', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.Hryvnia)).toBe('₴');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.Hryvnia)).toBe('₴');
});

it('UzbekSum', () => {
it('uzbek sum', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.UzbekSum)).toBe("So'm");
expect(tuiGetCurrencySymbol(TuiCurrencyCode.UzbekSum)).toBe("So'm");
});

it('KyrgyzstanSom', () => {
it('kyrgyzstan som', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.KyrgyzstanSom)).toBe('c');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.KyrgyzstanSom)).toBe('c');
});

it('Dirham', () => {
it('dirham', () => {
expect(tuiGetCurrencySymbol(TuiCurrency.Dirham)).toBe('Dh');
expect(tuiGetCurrencySymbol(TuiCurrencyCode.Dirham)).toBe('Dh');
});
Expand Down
12 changes: 6 additions & 6 deletions projects/addon-commerce/validators/test/luhn.validator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,42 @@ describe('tuiCreateLuhnValidator', () => {
const control = new FormControl('', tuiCreateLuhnValidator('error'));
const error = {luhn: new TuiValidationError('error')};

it('Valid card number is valid, check 1', () => {
it('valid card number is valid, check 1', () => {
control.setValue('4111 1111 1111 1111');
control.updateValueAndValidity();

expect(control.valid).toBe(true);
});

it('Valid card number is valid, check 2', () => {
it('valid card number is valid, check 2', () => {
control.setValue('4000 0000 0000 0333');
control.updateValueAndValidity();

expect(control.valid).toBe(true);
});

it('Valid card number is valid, check 3', () => {
it('valid card number is valid, check 3', () => {
control.setValue('5000 0000 0000 0108');
control.updateValueAndValidity();

expect(control.valid).toBe(true);
});

it('Invalid card number causes error, check 1', () => {
it('invalid card number causes error, check 1', () => {
control.setValue('1234 1234 1234 1234');
control.updateValueAndValidity();

expect(control.errors).toEqual(error);
});

it('Invalid card number causes error, check 2', () => {
it('invalid card number causes error, check 2', () => {
control.setValue('1234 5678 9123 4567');
control.updateValueAndValidity();

expect(control.errors).toEqual(error);
});

it('Invalid card number causes error, check 3', () => {
it('invalid card number causes error, check 3', () => {
control.setValue('2345 7823 4095 8723');
control.updateValueAndValidity();

Expand Down
2 changes: 1 addition & 1 deletion projects/addon-doc/tokens/test/tokens.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {TestBed} from '@angular/core/testing';
import {TUI_DOC_DEFAULT_TABS} from '@taiga-ui/addon-doc';

describe('Tokens', () => {
it('TUI_DOC_DEFAULT_TABS', () => {
it('tUI_DOC_DEFAULT_TABS', () => {
TestBed.configureTestingModule({});

const result = TestBed.inject(TUI_DOC_DEFAULT_TABS);
Expand Down
4 changes: 2 additions & 2 deletions projects/cdk/constants/test/handlers.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {TUI_FALSE_HANDLER, TUI_TRUE_HANDLER} from '@taiga-ui/cdk';

describe('Handler functions', () => {
it('Always false', () => {
it('always false', () => {
expect(TUI_FALSE_HANDLER()).toBe(false);
});

it('Always true', () => {
it('always true', () => {
expect(TUI_TRUE_HANDLER()).toBe(true);
});
});
4 changes: 2 additions & 2 deletions projects/cdk/date-time/test/day.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('TuiDay', () => {
});

describe('currentUtc returns date', () => {
it('UTC is the same as local', () => {
it('uTC is the same as local', () => {
tuiMockDateInside(new Date(2000, 0, 31, 10), () => {
const currentDate = TuiDay.currentUtc();

Expand All @@ -88,7 +88,7 @@ describe('TuiDay', () => {
});
});

it('UTC is smaller than local', () => {
it('uTC is smaller than local', () => {
tuiMockDateInside(new Date(2000, 0, 1, 2), () => {
const currentDate = TuiDay.currentUtc();

Expand Down
Loading

0 comments on commit f337849

Please sign in to comment.