Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.

Commit

Permalink
Adds tests for buildPath
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Solomon committed Mar 24, 2019
1 parent c1c607c commit 0f92838
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/util.test.ts
@@ -1,4 +1,34 @@
import { defaultOptions, ignoreAuth, ignoreStory } from "../dist";
import { buildPath } from "../dist/util";

test("build correct path", () => {
expect(buildPath(
{ Authorization: "Foo", ["User-Agent"]: "Bar" },
"www.foo.com",
undefined,
"path",
"GET",
"/v1/x",
"my-signature",
[],
"api.unmock.io",
true,
// tslint:disable-next-line:max-line-length
)).toBe("/x/?story=%5B%5D&path=%2Fv1%2Fx&hostname=www.foo.com&method=GET&headers=%7B%22Authorization%22%3A%22Foo%22%2C%22User-Agent%22%3A%22Bar%22%7D&ignore=%22path%22&signature=my-signature");
expect(buildPath(
{ Authorization: "Foo", ["User-Agent"]: "Bar" },
"www.foo.com",
undefined,
undefined,
"GET",
"/v1/x",
"my-signature",
[],
"api.unmock.io",
true,
// tslint:disable-next-line:max-line-length
)).toBe("/x/?story=%5B%5D&path=%2Fv1%2Fx&hostname=www.foo.com&method=GET&headers=%7B%22Authorization%22%3A%22Foo%22%2C%22User-Agent%22%3A%22Bar%22%7D&signature=my-signature");
});

test("ignoreStory produces correct json", () => {
expect(ignoreStory({})).toEqual({
Expand Down

0 comments on commit 0f92838

Please sign in to comment.