Skip to content

Commit

Permalink
test: improve covers
Browse files Browse the repository at this point in the history
  • Loading branch information
2fd committed Dec 21, 2020
1 parent 01adbeb commit e098cd0
Show file tree
Hide file tree
Showing 9 changed files with 181 additions and 69 deletions.
25 changes: 0 additions & 25 deletions plugins/__test__/navigation.enum.test.ts

This file was deleted.

24 changes: 0 additions & 24 deletions plugins/__test__/navigation.input.test.ts

This file was deleted.

17 changes: 0 additions & 17 deletions plugins/__test__/navigation.interface.test.ts

This file was deleted.

@@ -1,6 +1,6 @@
import NavigationDirectives from "../navigation.directive";
import schema from "./empty.schema.json";
import projectPackage from "./projectPackage.json";
import NavigationDirectives from "./navigation.directive";
import projectPackage from "../test/empty.package.json";
import schema from "../test/empty.schema.json";

describe("pĺugins/navigation.directive#NavigationDirectives", () => {

Expand Down
35 changes: 35 additions & 0 deletions plugins/navigation.enum.test.ts
@@ -0,0 +1,35 @@
import projectPackage from "../test/empty.package.json";
import NavigationEnums from "./navigation.enum";
import schema from "../test/empty.schema.json";

describe("pĺugins/navigation.directive#NavigationDirectives", () => {
test("plugin return empty", () => {
const plugin = new NavigationEnums(
{
...schema.data.__schema,
types: [],
},
projectPackage,
{}
);

expect(plugin.getNavigations("Query")).toEqual([])
})

test("plugin return navigation", () => {
const plugin = new NavigationEnums(schema.data.__schema, projectPackage, {});
expect(plugin.getNavigations("Query")).toEqual([
{
title: "Enums",
items: [
{
text: "__DirectiveLocation",
href: "/directivelocation.spec.html",
isActive: false
},
{ text: "__TypeKind", href: "/typekind.spec.html", isActive: false }
]
}
]);
});
});
34 changes: 34 additions & 0 deletions plugins/navigation.input.test.ts
@@ -0,0 +1,34 @@
import projectPackage from "../test/empty.package.json";
import NavigationInputs from "./navigation.input";
import schema from "../test/empty.schema.json";

describe("pĺugins/navigation.directive#NavigationDirectives", () => {
test("plugin return empty", () => {
const plugin = new NavigationInputs(
{
...schema.data.__schema,
types: [],
},
projectPackage,
{}
);

expect(plugin.getNavigations("Query")).toEqual([])
})

test("plugin return navigation", () => {
const plugin = new NavigationInputs(schema.data.__schema, projectPackage, {});
expect(plugin.getNavigations("Query")).toEqual([
{
title: "Input Objects",
items: [
{
text: "AddCommentInput",
href: "/addcommentinput.doc.html",
isActive: false
}
]
}
]);
});
});
109 changes: 109 additions & 0 deletions plugins/navigation.interface.test.ts
@@ -0,0 +1,109 @@
import projectPackage from "../test/empty.package.json";
import NavigationInterfaces from "./navigation.interface";
import schema from "../test/github.json";

describe("pĺugins/navigation.interface#NavigationInterfaces", () => {
test("plugin return empty", () => {
const plugin = new NavigationInterfaces(
{
...schema.data.__schema,
types: [],
},
projectPackage,
{}
);

expect(plugin.getNavigations("Query")).toEqual([])
});

test("plugin return navigation", () => {
const plugin = new NavigationInterfaces(
schema.data.__schema,
projectPackage,
{}
);

expect(plugin.getNavigations("Query")).toEqual([
{
title: "Interfaces",
items: [
{
"href": "/author.doc.html",
"isActive": false,
"text": "Author",
},
{
"href": "/comment.doc.html",
"isActive": false,
"text": "Comment",
},
{
"href": "/gitobject.doc.html",
"isActive": false,
"text": "GitObject",
},
{
"href": "/gitsignature.doc.html",
"isActive": false,
"text": "GitSignature",
},
{
"href": "/issueevent.doc.html",
"isActive": false,
"text": "IssueEvent",
},
{
"href": "/issueish.doc.html",
"isActive": false,
"text": "Issueish",
},
{
"href": "/node.doc.html",
"isActive": false,
"text": "Node",
},
{
"href": "/projectowner.doc.html",
"isActive": false,
"text": "ProjectOwner",
},
{
"href": "/reactable.doc.html",
"isActive": false,
"text": "Reactable",
},
{
"href": "/repositoryinfo.doc.html",
"isActive": false,
"text": "RepositoryInfo",
},
{
"href": "/repositorynode.doc.html",
"isActive": false,
"text": "RepositoryNode",
},
{
"href": "/repositoryowner.doc.html",
"isActive": false,
"text": "RepositoryOwner",
},
{
"href": "/subscribable.doc.html",
"isActive": false,
"text": "Subscribable",
},
{
"href": "/timeline.doc.html",
"isActive": false,
"text": "Timeline",
},
{
"href": "/uniformresourcelocatable.doc.html",
"isActive": false,
"text": "UniformResourceLocatable",
},
]
}
]);
});
});
File renamed without changes.
File renamed without changes.

0 comments on commit e098cd0

Please sign in to comment.