Update ESLint and Prettier

This commit is contained in:
Zaid Abdulla committed 2020-07-27 20:30:13 -07:00
1 parent 5a9e03db2c
commit ac980116bd
110 files changed
+2993 -2794

No files matched your search

+11 -38
View File
@@ -1,35 +1,7 @@
import ava from "ava";
import * as common from "../lib/common";
ava("typeOf", t => {
const cases = [
[undefined, common.UNDEFINED_TYPE],
[null, common.NULL_TYPE],
[true, common.BOOLEAN_TYPE],
[false, common.BOOLEAN_TYPE],
[0, common.NUMBER_TYPE],
[1, common.NUMBER_TYPE],
[-1, common.NUMBER_TYPE],
[0.0, common.NUMBER_TYPE],
[1.0, common.NUMBER_TYPE],
[1.1, common.NUMBER_TYPE],
[-1.0, common.NUMBER_TYPE],
[-1.1, common.NUMBER_TYPE],
["", common.STRING_TYPE],
["TEST", common.STRING_TYPE],
[[], common.ARRAY_TYPE],
[[1, 2, 3], common.ARRAY_TYPE],
[{}, common.OBJECT_TYPE],
[{ test: 1 }, common.OBJECT_TYPE],
[/[^A-Za-z0-9_]/g, common.REGEXP_TYPE],
[new RegExp("//"), common.REGEXP_TYPE],
[new Date(), common.DATE_TYPE]
];
t.plan(cases.length);
for (const c of cases) t.is(common.typeOf(c[0]), c[1]);
});
ava("generateDeviceId", t => {
ava("generateDeviceId", (t) => {
const space = [" ", "%20"];
const special = [";", "%3B"];
const cases = [
@@ -37,30 +9,31 @@ ava("generateDeviceId", t => {
{
ProductClass: "TestProductClass",
OUI: "TestOUI",
SerialNumber: "TestSerialNumber"
SerialNumber: "TestSerialNumber",
},
"TestOUI-TestProductClass-TestSerialNumber"
"TestOUI-TestProductClass-TestSerialNumber",
],
[
{
OUI: "TestOUI",
SerialNumber: "TestSerialNumber"
SerialNumber: "TestSerialNumber",
},
"TestOUI-TestSerialNumber"
"TestOUI-TestSerialNumber",
],
[
{
OUI: `TestOUIWith${space[0]}_${special[0]}2912`,
SerialNumber: `TestSerialNumberWith${space[0]}_${special[0]}2912`
SerialNumber: `TestSerialNumberWith${space[0]}_${special[0]}2912`,
},
`TestOUIWith${space[1]}_${special[1]}2912-TestSerialNumberWith${space[1]}_${special[1]}2912`
]
`TestOUIWith${space[1]}_${special[1]}2912-TestSerialNumberWith${space[1]}_${special[1]}2912`,
],
];
t.plan(cases.length);
for (const c of cases) t.is(common.generateDeviceId(c[0]), c[1]);
for (const c of cases)
t.is(common.generateDeviceId(c[0] as Record<string, string>), c[1]);
});
ava("escapeRegExp", t => {
ava("escapeRegExp", (t) => {
t.is(
common.escapeRegExp("\\ ^ $ * + ? . ( ) | { } [ ]"),
"\\\\ \\^ \\$ \\* \\+ \\? \\. \\( \\) \\| \\{ \\} \\[ \\]"