Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tsvetomir committed Jan 3, 2025
1 parent c5a6475 commit 8a1bd8d
Show file tree
Hide file tree
Showing 7 changed files with 641 additions and 663 deletions.
2 changes: 1 addition & 1 deletion locale-tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export function clean() {

export const LOCALES =
fs.readdirSync(path.join('./node_modules', 'cldr-localenames-full', 'main'))
.filter(locale => locale !== 'root');
.filter(locale => locale !== 'root');

export const NO_CURRENCY_LOCALE = 'es-419';
2 changes: 1 addition & 1 deletion src/cldr/currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { errors } from '../errors';
import localeTerritory from './territory';
import parseRangeDate from './parse-range-date';

/* eslint-disable consistent-return */

const {
NoCurrency,
Expand Down
316 changes: 155 additions & 161 deletions test/cldr-data-compat.test.js

Large diffs are not rendered by default.

316 changes: 155 additions & 161 deletions test/cldr.test.js

Large diffs are not rendered by default.

283 changes: 141 additions & 142 deletions test/dates.test.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions test/format.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ describe('toString', () => {
}

it('formats value as date', () => {
expect(toString(new Date(2000, 0, 30), "d", "en")).toEqual("1/30/2000");
expect(toString(new Date(2000, 0, 30), "d", "en")).toBe("1/30/2000");
});

it('formats value as date based on the specified locale', () => {
expect(toString(new Date(2000, 0, 30), "d", "bg")).toEqual("30.01.2000 г.");
expect(toString(new Date(2000, 0, 30), "d", "bg")).toBe("30.01.2000 г.");
});

it('formats value as number', () => {
expect(toString(10, "c", "en")).toEqual("$10.00");
expect(toString(10, "c", "en")).toBe("$10.00");
});

it('formats value as number based on the specified locale', () => {
expect(toString(10, "c", "bg")).toEqual("10,00 лв.");
expect(toString(10, "c", "bg")).toBe("10,00 лв.");
});

it('returns empty string if the value is undefined', () => {
Expand All @@ -49,14 +49,14 @@ describe('toString', () => {

describe('format', () => {
it('replaces placeholders', () => {
expect(format("{0}-{1}", ["foo", "bar"])).toEqual("foo-bar");
expect(format("{0}-{1}", ["foo", "bar"])).toBe("foo-bar");
});

it('formats values based on specified format', () => {
expect(format("{0:d}-{1:c}", [new Date(2000, 0, 30), 10])).toEqual("1/30/2000-$10.00");
expect(format("{0:d}-{1:c}", [new Date(2000, 0, 30), 10])).toBe("1/30/2000-$10.00");
});

it('formats values based on specified format and locale', () => {
expect(format("{0:d}-{1:c}", [new Date(2000, 0, 30), 10], "bg")).toEqual("30.01.2000 г.-10,00 лв.");
expect(format("{0:d}-{1:c}", [new Date(2000, 0, 30), 10], "bg")).toBe("30.01.2000 г.-10,00 лв.");
});
});
Loading

0 comments on commit 8a1bd8d

Please sign in to comment.