Skip to content

Commit

Permalink
re-enable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
johnste committed Jan 28, 2021
1 parent 3e1259f commit 3ed758d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 37 deletions.
76 changes: 40 additions & 36 deletions config-api/src/fastidious/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe("test", () => {

test("Optional", () => {
const schema = {
a: v.boolean
a: v.boolean,
};

expect(f({ a: true }, schema)).toHaveLength(0);
Expand All @@ -17,7 +17,7 @@ describe("test", () => {

test("Required", () => {
const schema = {
a: v.boolean.isRequired
a: v.boolean.isRequired,
};

expect(f({ a: true }, schema)).toHaveLength(0);
Expand All @@ -27,15 +27,15 @@ describe("test", () => {

test("Extraneous properties", () => {
const schema = {
a: v.boolean
a: v.boolean,
};

expect(f({ b: true, c: "string" }, schema)).toHaveLength(2);
});

test("Boolean", () => {
const schema = {
a: v.boolean.isRequired
a: v.boolean.isRequired,
};

expect(f({ a: true }, schema)).toHaveLength(0);
Expand All @@ -47,7 +47,7 @@ describe("test", () => {

test("Number", () => {
const schema = {
a: v.number.isRequired
a: v.number.isRequired,
};

expect(f({ a: 5 }, schema)).toHaveLength(0);
Expand All @@ -65,7 +65,7 @@ describe("test", () => {

test("String", () => {
const schema = {
a: v.string.isRequired
a: v.string.isRequired,
};

expect(f({ a: "test" }, schema)).toHaveLength(0);
Expand All @@ -77,7 +77,7 @@ describe("test", () => {

test("Function", () => {
const schema = {
a: v.function("test").isRequired
a: v.function("test").isRequired,
};

expect(f({ a() {} }, schema)).toHaveLength(0);
Expand All @@ -88,7 +88,7 @@ describe("test", () => {

test("RegExp", () => {
const schema = {
a: v.regex.isRequired
a: v.regex.isRequired,
};

expect(f({ a: /test/ }, schema)).toHaveLength(0);
Expand All @@ -100,7 +100,7 @@ describe("test", () => {
describe("Value", () => {
test("validator", () => {
const schema = {
a: v.value("value").isRequired
a: v.value("value").isRequired,
};

expect(f({ a: "value" }, schema)).toHaveLength(0);
Expand All @@ -111,7 +111,7 @@ describe("test", () => {
test("validator", () => {
const value: any[] = [];
const schema = {
a: v.value(value).isRequired
a: v.value(value).isRequired,
};

expect(f({ a: value }, schema)).toHaveLength(0);
Expand All @@ -121,7 +121,7 @@ describe("test", () => {

test("null value", () => {
const schema = {
a: v.value(null).isRequired
a: v.value(null).isRequired,
};

expect(f({ a: null }, schema)).toHaveLength(0);
Expand All @@ -130,7 +130,7 @@ describe("test", () => {

test("OneOf", () => {
const schema = {
a: v.oneOf([v.boolean, v.string]).isRequired
a: v.oneOf([v.boolean, v.string]).isRequired,
};

expect(f({ a: "test" }, schema)).toHaveLength(0);
Expand All @@ -151,16 +151,16 @@ describe("test", () => {
args: v.arrayOf(v.string),
}),
v.function("options"),
v.value(null)
]).isRequired
v.value(null),
]).isRequired,
};
expect(f({ value: null }, schema)).toHaveLength(0);
});

describe("ArrayOf", () => {
test("optional", () => {
const schema = {
a: v.arrayOf(v.boolean).isRequired
a: v.arrayOf(v.boolean).isRequired,
};

expect(f({ a: [true, false] }, schema)).toHaveLength(0);
Expand All @@ -170,7 +170,7 @@ describe("test", () => {

test("required", () => {
const schema = {
a: v.arrayOf(v.boolean.isRequired).isRequired
a: v.arrayOf(v.boolean.isRequired).isRequired,
};

expect(f({ a: [true, false] }, schema)).toHaveLength(0);
Expand All @@ -180,7 +180,7 @@ describe("test", () => {

test("shape", () => {
const schema = {
a: v.shape({ bool: v.boolean.isRequired, string: v.string }).isRequired
a: v.shape({ bool: v.boolean.isRequired, string: v.string }).isRequired,
};

expect(f({ a: { bool: true, string: "string" } }, schema)).toHaveLength(0);
Expand All @@ -190,7 +190,8 @@ describe("test", () => {

test("shape 2", () => {
const schema = {
a: v.shape({ bool: v.boolean.isRequired, string: v.string.isRequired }).isRequired
a: v.shape({ bool: v.boolean.isRequired, string: v.string.isRequired })
.isRequired,
};

expect(f({ a: {} }, schema)).toHaveLength(1);
Expand All @@ -208,8 +209,8 @@ describe("Complex", () => {
appType: v.oneOf(["appName", "bundleId", "appPath"]),
openInBackground: v.boolean,
args: v.arrayOf(v.string),
})
]).isRequired
}),
]).isRequired,
};

expect(f({ app: "string" }, schema)).toHaveLength(0);
Expand All @@ -218,8 +219,8 @@ describe("Complex", () => {
{
app: {
name: "string",
appType: "appName"
}
appType: "appName",
},
},
schema
)
Expand All @@ -237,16 +238,16 @@ describe("Complex", () => {
openInBackground: v.boolean,
args: v.arrayOf(v.string),
anotherShape: v.shape({
boool: v.boolean
})
})
]).isRequired
boool: v.boolean,
}),
}),
]).isRequired,
};

expect(
f(
{
app: /error/
app: /error/,
},
schema
)
Expand All @@ -255,13 +256,13 @@ describe("Complex", () => {

test("Serialize functions to readable description", () => {
const schema = {
lapp: v.boolean
lapp: v.boolean,
};

expect(
f(
{
lapp: () => {}
lapp: () => {},
},
schema
)
Expand All @@ -274,13 +275,13 @@ describe("Complex", () => {

test("Serialize expected objects to readable description", () => {
const schema = {
test: v.shape({ key: v.boolean }).isRequired
test: v.shape({ key: v.boolean }).isRequired,
};

expect(
f(
{
test: "true"
test: "true",
},
schema
)
Expand Down Expand Up @@ -322,7 +323,7 @@ describe("Single values", () => {
});
});

test.only("test x", () => {
test("test x", () => {
const browserSchema = v.oneOf([
v.string,
v.shape({
Expand All @@ -332,19 +333,22 @@ test.only("test x", () => {
args: v.arrayOf(v.string),
}),
v.function("options"),
v.value(null)
v.value(null),
]);

const multipleBrowsersSchema = v.oneOf([browserSchema, v.arrayOf(browserSchema.isRequired)]);
const multipleBrowsersSchema = v.oneOf([
browserSchema,
v.arrayOf(browserSchema.isRequired),
]);

const schema = {
defaultBrowser: multipleBrowsersSchema.isRequired
defaultBrowser: multipleBrowsersSchema.isRequired,
};

expect(
f(
{
defaultBrowser: ["fest", "test"]
defaultBrowser: ["fest", "test"],
},
schema
)
Expand Down
2 changes: 1 addition & 1 deletion config-api/test/processUrl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe("Rewrites", () => {
expect(result.url).toBe("https://test.example?https");
});

test.only("Object result ", () => {
test("Object result ", () => {
const config = createRewriteConfig({
urlResult: ({ url }) => ({
...url,
Expand Down

0 comments on commit 3ed758d

Please sign in to comment.