Skip to content

Commit

Permalink
added support for LINK and UNLINK HTTP methods
Browse files Browse the repository at this point in the history
  • Loading branch information
domi1033 committed Jun 21, 2021
1 parent d789550 commit a22ffe5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var VERBS = [
"put",
"options",
"list",
"link",
"unlink",
];

function adapter() {
Expand Down
2 changes: 2 additions & 0 deletions test/basics.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ describe("MockAdapter basics", function () {
expect(mock.onPatch).to.be.a("function");
expect(mock.onOptions).to.be.a("function");
expect(mock.onList).to.be.a("function");
expect(mock.onLink).to.be.a("function");
expect(mock.onUnlink).to.be.a("function");
});

it("mocks requests", function () {
Expand Down
7 changes: 7 additions & 0 deletions test/on_any.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@ describe("MockAdapter onAny", function () {
mock.onAny("/foo").reply(200);

expect(mock.handlers["get"]).not.to.be.empty;
expect(mock.handlers["post"]).not.to.be.empty;
expect(mock.handlers["head"]).not.to.be.empty;
expect(mock.handlers["delete"]).not.to.be.empty;
expect(mock.handlers["patch"]).not.to.be.empty;
expect(mock.handlers["put"]).not.to.be.empty;
expect(mock.handlers["options"]).not.to.be.empty;
expect(mock.handlers["list"]).not.to.be.empty;
expect(mock.handlers["link"]).not.to.be.empty;
expect(mock.handlers["unlink"]).not.to.be.empty;
});

it("mocks any request with a matching url", function () {
Expand Down
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ declare class MockAdapter {
onList: RequestMatcherFunc;
onOptions: RequestMatcherFunc;
onAny: RequestMatcherFunc;
onLink: RequestMatcherFunc;
onUnlink: RequestMatcherFunc;
}

export default MockAdapter;
2 changes: 2 additions & 0 deletions types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ namespace SupportsAllHttpVerbs {
mock.onDelete;
mock.onPatch;
mock.onList;
mock.onLink;
mock.onUnlink;
}

namespace SupportsAnyVerb {
Expand Down

0 comments on commit a22ffe5

Please sign in to comment.