-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
205 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import { areSame } from "./"; | ||
import { areSame } from './'; | ||
|
||
describe("areSame valid cases", () => { | ||
describe('areSame valid cases', () => { | ||
test.each` | ||
input | expected | ||
${[1, 1, 1]} | ${true} | ||
${["one", "one", "one"]} | ${true} | ||
${['one', 'one', 'one']} | ${true} | ||
${[1.5, 1.5, 1.5]} | ${true} | ||
${[true, true, true]} | ${true} | ||
`("should return $expected when input is: $input", ({ input, expected }) => { | ||
`('should return $expected when input is: $input', ({ input, expected }) => { | ||
expect(areSame(input)).toBe(expected); | ||
}); | ||
}); | ||
|
||
describe("areEqual invalid cases", () => { | ||
describe('areEqual invalid cases', () => { | ||
test.each` | ||
input | expected | ||
${[1, 2, 3]} | ${false} | ||
${["one", "two", "three"]} | ${false} | ||
${['one', 'two', 'three']} | ${false} | ||
${[1.5, 2.5, 3.5]} | ${false} | ||
${[true, false, true]} | ${false} | ||
`("should return $expected when input is: $input", ({ input, expected }) => { | ||
`('should return $expected when input is: $input', ({ input, expected }) => { | ||
expect(areSame(input)).toBe(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { countItems } from "./"; | ||
import { countItems } from './'; | ||
|
||
describe("countItems cases", () => { | ||
describe('countItems cases', () => { | ||
test.each` | ||
input | expected | ||
${[1, 1, 1, 2]} | ${{ "1": 3, "2": 1 }} | ||
${["in", "love", "love", "love"]} | ${{ in: 1, love: 3 }} | ||
`("should return $expected when input is: $input", ({ input, expected }) => { | ||
${[1, 1, 1, 2]} | ${{ '1': 3, '2': 1 }} | ||
${['in', 'love', 'love', 'love']} | ${{ in: 1, love: 3 }} | ||
`('should return $expected when input is: $input', ({ input, expected }) => { | ||
expect(countItems(input)).toStrictEqual(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { hasDuplicates } from "./"; | ||
import { hasDuplicates } from './'; | ||
|
||
describe("hasDuplicates cases", () => { | ||
describe('hasDuplicates cases', () => { | ||
test.each` | ||
array | expected | ||
${[1, 1, 2]} | ${true} | ||
${["one", "one", "two"]} | ${true} | ||
${['one', 'one', 'two']} | ${true} | ||
${[1, 2, 3]} | ${false} | ||
${["one", "two", "three"]} | ${false} | ||
`("should return $expected when array is: $array", ({ array, expected }) => { | ||
${['one', 'two', 'three']} | ${false} | ||
`('should return $expected when array is: $array', ({ array, expected }) => { | ||
expect(hasDuplicates(array)).toBe(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
import { indexBy } from "."; | ||
import { indexBy } from '.'; | ||
|
||
describe("indexBy cases", () => { | ||
describe('indexBy cases', () => { | ||
const withUniqueKey = [ | ||
{ id: 1, name: "A" }, | ||
{ id: 2, name: "B" }, | ||
{ id: 3, name: "C" }, | ||
{ id: 1, name: 'A' }, | ||
{ id: 2, name: 'B' }, | ||
{ id: 3, name: 'C' }, | ||
]; | ||
|
||
const withUniqueKeyExpected = { | ||
"1": { id: 1, name: "A" }, | ||
"2": { id: 2, name: "B" }, | ||
"3": { id: 3, name: "C" }, | ||
'1': { id: 1, name: 'A' }, | ||
'2': { id: 2, name: 'B' }, | ||
'3': { id: 3, name: 'C' }, | ||
}; | ||
|
||
const withDuplicatedKey = [ | ||
{ id: 1, name: "A" }, | ||
{ id: 1, name: "B" }, | ||
{ id: 3, name: "C" }, | ||
{ id: 1, name: 'A' }, | ||
{ id: 1, name: 'B' }, | ||
{ id: 3, name: 'C' }, | ||
]; | ||
|
||
// On duplicate keys should be replaced the repeated key with the last one. | ||
const withDuplicatedKeyExpected = { | ||
"1": { id: 1, name: "B" }, | ||
"3": { id: 3, name: "C" }, | ||
'1': { id: 1, name: 'B' }, | ||
'3': { id: 3, name: 'C' }, | ||
}; | ||
|
||
test.each` | ||
input | expected | ||
${withUniqueKey} | ${withUniqueKeyExpected} | ||
${withDuplicatedKey} | ${withDuplicatedKeyExpected} | ||
`("should return $expected when input is: $input", ({ input, expected }) => { | ||
expect(indexBy([...input], "id")).toStrictEqual(expected); | ||
`('should return $expected when input is: $input', ({ input, expected }) => { | ||
expect(indexBy([...input], 'id')).toStrictEqual(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
export { areSame } from "./are-same"; | ||
export { countItems } from "./count-items"; | ||
export { hasDuplicates } from "./has-duplicates"; | ||
export { isArray } from "./is-array"; | ||
export { isArrayOfString } from "./is-array-of-string"; | ||
export { isDate } from "./is-date"; | ||
export { isDateString as isDateValid } from "./is-date-string"; | ||
export { isDefined } from "./is-defined"; | ||
export { isEmpty } from "./is-empty"; | ||
export { isEqual } from "./is-equal"; | ||
export { isEqualDate } from "./is-equal-date"; | ||
export { isMap } from "./is-map"; | ||
export { isNumber } from "./is-number"; | ||
export { isObject } from "./is-object"; | ||
export { isObjectLike } from "./is-object-like"; | ||
export { isSet } from "./is-set"; | ||
export { isString } from "./is-string"; | ||
export { isNull } from "./is-null"; | ||
export { omitBy } from "./omit-by"; | ||
export { toChunks } from "./to-chunks"; | ||
export { indexBy } from "./index-by"; | ||
export { wrapInArray } from "./wrap-in-array"; | ||
export { getLength } from "./get-length"; | ||
export { areSame } from './are-same'; | ||
export { countItems } from './count-items'; | ||
export { hasDuplicates } from './has-duplicates'; | ||
export { isArray } from './is-array'; | ||
export { isArrayOfString } from './is-array-of-string'; | ||
export { isDate } from './is-date'; | ||
export { isDateString as isDateValid } from './is-date-string'; | ||
export { isDefined } from './is-defined'; | ||
export { isEmpty } from './is-empty'; | ||
export { isEqual } from './is-equal'; | ||
export { isEqualDate } from './is-equal-date'; | ||
export { isMap } from './is-map'; | ||
export { isNumber } from './is-number'; | ||
export { isObject } from './is-object'; | ||
export { isObjectLike } from './is-object-like'; | ||
export { isSet } from './is-set'; | ||
export { isString } from './is-string'; | ||
export { isNull } from './is-null'; | ||
export { omitBy } from './omit-by'; | ||
export { toChunks } from './to-chunks'; | ||
export { indexBy } from './index-by'; | ||
export { wrapInArray } from './wrap-in-array'; | ||
export { getLength } from './get-length'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { getTag } from "./index"; | ||
import { getTag } from './index'; | ||
|
||
describe("getTag cases", () => { | ||
describe('getTag cases', () => { | ||
test.each` | ||
input | expected | ||
${new Set()} | ${"[object Set]"} | ||
${new Map()} | ${"[object Map]"} | ||
${{}} | ${"[object Object]"} | ||
${""} | ${"[object String]"} | ||
${1} | ${"[object Number]"} | ||
${null} | ${"[object Null]"} | ||
${undefined} | ${"[object Undefined]"} | ||
${new Date()} | ${"[object Date]"} | ||
${Symbol()} | ${"[object Symbol]"} | ||
`("should return $expected when input is: $input", ({ input, expected }) => { | ||
${new Set()} | ${'[object Set]'} | ||
${new Map()} | ${'[object Map]'} | ||
${{}} | ${'[object Object]'} | ||
${''} | ${'[object String]'} | ||
${1} | ${'[object Number]'} | ||
${null} | ${'[object Null]'} | ||
${undefined} | ${'[object Undefined]'} | ||
${new Date()} | ${'[object Date]'} | ||
${Symbol()} | ${'[object Symbol]'} | ||
`('should return $expected when input is: $input', ({ input, expected }) => { | ||
expect(getTag(input)).toBe(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { getTag } from "./_get-tag"; | ||
export { getTag } from './_get-tag'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { isArrayOfString } from "./"; | ||
import { isArrayOfString } from './'; | ||
|
||
describe("isArrayOfString cases", () => { | ||
describe('isArrayOfString cases', () => { | ||
test.each` | ||
input | expected | ||
${["a", "b", "c"]} | ${true} | ||
${["a", "b", 1]} | ${false} | ||
`("should return $expected when input is: $input", ({ input, expected }) => { | ||
${['a', 'b', 'c']} | ${true} | ||
${['a', 'b', 1]} | ${false} | ||
`('should return $expected when input is: $input', ({ input, expected }) => { | ||
expect(isArrayOfString(input)).toBe(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { isArray } from "./"; | ||
import { isArray } from './'; | ||
|
||
describe("isArray cases", () => { | ||
describe('isArray cases', () => { | ||
test.each` | ||
input | expected | ||
${[1, 1, 1]} | ${true} | ||
${["one", "one"]} | ${true} | ||
${['one', 'one']} | ${true} | ||
${[{ id: 1 }, { id: 2 }]} | ${true} | ||
${"string"} | ${false} | ||
${'string'} | ${false} | ||
${null} | ${false} | ||
`("should return $expected when input is: $input", ({ input, expected }) => { | ||
`('should return $expected when input is: $input', ({ input, expected }) => { | ||
expect(isArray(input)).toBe(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import { isDateValid } from "./"; | ||
import { isDateValid } from './'; | ||
|
||
describe("isDateValid valid cases", () => { | ||
describe('isDateValid valid cases', () => { | ||
test.each` | ||
input | expected | ||
${"01/01/2000"} | ${true} | ||
${"31/01/2000"} | ${true} | ||
${"32/01/2000"} | ${false} | ||
${"01/1/2000"} | ${true} | ||
${"01/1/01"} | ${true} | ||
${"29/02/2000"} | ${true} | ||
${"28/02/2001"} | ${true} | ||
${"29/02/2001"} | ${false} | ||
${"29 Feb 2001"} | ${false} | ||
${"29 Feb 2020"} | ${true} | ||
${"26 OCT 2024"} | ${true} | ||
${"01/Mar/2020"} | ${true} | ||
${"1.1.1"} | ${false} | ||
`("should return $expected when input is: $input", ({ input, expected }) => { | ||
${'01/01/2000'} | ${true} | ||
${'31/01/2000'} | ${true} | ||
${'32/01/2000'} | ${false} | ||
${'01/1/2000'} | ${true} | ||
${'01/1/01'} | ${true} | ||
${'29/02/2000'} | ${true} | ||
${'28/02/2001'} | ${true} | ||
${'29/02/2001'} | ${false} | ||
${'29 Feb 2001'} | ${false} | ||
${'29 Feb 2020'} | ${true} | ||
${'26 OCT 2024'} | ${true} | ||
${'01/Mar/2020'} | ${true} | ||
${'1.1.1'} | ${false} | ||
`('should return $expected when input is: $input', ({ input, expected }) => { | ||
expect(isDateValid(input)).toBe(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { isDate } from "./"; | ||
import { isDate } from './'; | ||
|
||
describe("isDate cases", () => { | ||
describe('isDate cases', () => { | ||
test.each` | ||
input | expected | ||
${new Date()} | ${true} | ||
${"29 Feb 2020"} | ${false} | ||
`("should return $expected when input is: $input", ({ input, expected }) => { | ||
${'29 Feb 2020'} | ${false} | ||
`('should return $expected when input is: $input', ({ input, expected }) => { | ||
expect(isDate(input)).toBe(expected); | ||
}); | ||
}); |
Oops, something went wrong.