This commit is contained in:
Tsvetomir Tsonev 2022-07-06 09:21:37 +03:00 коммит произвёл Tsvetomir Tsonev
Родитель 5d719e8203
Коммит bf69f39c77
9 изменённых файлов: 20 добавлений и 10 удалений

5
jest.config.json Normal file
Просмотреть файл

@ -0,0 +1,5 @@
{
"preset": "es-jest",
"testRegex": ["/test/.*\\.test\\.js$", "/locale-tests/.*\\.test\\.js$"],
"testTimeout": 20000
}

Просмотреть файл

@ -11,8 +11,8 @@
"typings": "dist/npm/main.d.ts",
"scripts": {
"build-package": "gulp build-rollup-package build-cdn",
"test": "gulp test",
"locale-tests": "gulp test --tests=\"locale-tests/generated-locales.js\"",
"test": "jest -- test/",
"locale-tests": "jest -- locale-tests/",
"lint": "eslint ./src",
"semantic-release": "semantic-release pre && semantic-prerelease publish && semantic-release post"
},
@ -32,9 +32,11 @@
"cldr-numbers-full": "^41.0.0",
"cldr-units-full": "^41.0.0",
"cz-conventional-changelog": "^1.1.5",
"es-jest": "^1.5.0",
"eslint": "^8.16.0",
"ghooks": "^1.0.3",
"gulp": "^4.0.0",
"jest-cli": "^26.6.3",
"semantic-release": "^6.3.6",
"validate-commit-msg": "^1.1.1"
},

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -440,7 +440,7 @@ describe('date parsing', () => {
it("returns null if no value is passed", () => {
const result = parseDate();
expect(result).toBeNull(null);
expect(result).toBeNull();
});
it('parses d ISO format', function () {
@ -461,7 +461,7 @@ describe('date parsing', () => {
});
it('short year 29 should return year 2029', function () {
expect(parseDate("12/23/29", "M/d/yy").getFullYear(), 2029);
expect(parseDate("12/23/29", "M/d/yy").getFullYear()).toBe(2029);
});
it('prases formats with leading and trailing spaces', function () {
@ -831,7 +831,7 @@ describe('date parsing', () => {
const dateFormat = "MM/dd/yyyy";
const result = parseDate("1//2100", dateFormat);
expect(result, null);
expect(result).toBeNull();
});
it('parses MMMM yyyy date format', function () {
@ -859,7 +859,7 @@ describe('date parsing', () => {
const wideNames = dateFormatNames(info, { type: "dayPeriods", nameType: "wide" });
abbreviatedNames.am = wideNames.am;
const result = parseDate("2016. 05. 27. 오전 11:00:00", "G", "ko");
expect(isValidDateTime(result, 2016, 5, 27, 11, 0, 0, 0 ,0), result).toBe(true);
expect(isValidDateTime(result, 2016, 5, 27, 11, 0, 0, 0 ,0)).toBe(true);
});
it('should return null if only year is passed', function () {
@ -915,7 +915,7 @@ describe('date parsing', () => {
it("returns null if string is not valid ISO8601", () => {
const utcDate = new Date(Date.UTC(2000, 9, 10, 14, 30, 0));
expect(parseDate("2000-10-1014:30Z", "yyyy-MM-ddTHH:mmX"), null);
expect(parseDate("2000-10-1014:30Z", "yyyy-MM-ddTHH:mmX")).toBeNull();
});
it("parses UTC milliseconds correctly", () => {

Просмотреть файл

@ -11,7 +11,7 @@ describe('Intl', () => {
const result = `${error.name}: ${error.message}`;
expect(intlError.formatMessage(), result);
expect(intlError.formatMessage()).toBe(result);
});
it('should replace single placeholder in the message', () => {
@ -24,7 +24,7 @@ describe('Intl', () => {
const result = `${error.name}: Big error! p1 p2`;
expect(intlError.formatMessage("p1", "p2"), result);
expect(intlError.formatMessage("p1", "p2")).toBe(result);
});
it('should return instance with message', () => {

Просмотреть файл

@ -3,8 +3,11 @@ import { toString, format } from '../src/format';
const likelySubtags = require("cldr-core/supplemental/likelySubtags.json");
const calendar = require("cldr-dates-full/main/bg/ca-gregorian.json");
const numbers = require("cldr-numbers-full/main/bg/numbers.json");
const currencies = require("cldr-numbers-full/main/bg/currencies.json");
const currencyData = require("cldr-core/supplemental/currencyData.json");
load(likelySubtags, calendar);
load(likelySubtags, calendar, currencyData, numbers, currencies);
describe('toString', () => {
function logCharCodes(value) {

Просмотреть файл