Skip to content

Commit

Permalink
fix(helpers): identifies bug in isURLSameOrigin
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbhesswebber committed Oct 13, 2022
1 parent ef1c48a commit 4777b7a
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions test/specs/helpers/isURLSameOrigin.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import isURLSameOrigin from '../../../lib/helpers/isURLSameOrigin';
import isURLSameOrigin from "../../../lib/helpers/isURLSameOrigin";

describe('helpers::isURLSameOrigin', function () {
it('should detect same origin', function () {
describe("helpers::isURLSameOrigin", function () {
it("should detect same origin", function () {
expect(isURLSameOrigin(window.location.href)).toEqual(true);
});

it('should detect different origin', function () {
expect(isURLSameOrigin('https://github.com/axios/axios')).toEqual(false);
it("should detect different origin", function () {
expect(isURLSameOrigin("https://github.com/axios/axios")).toEqual(false);
});

it("should gracefully handle 'accidentally' invalid arguments", () => {
const catcher = () => {
isURLSameOrigin(undefined);
isURLSameOrigin(null);
isURLSameOrigin(false);
isURLSameOrigin(5);
isURLSameOrigin([]);
isURLSameOrigin({});
};
expect(catcher).not.toThrow();
});
});

0 comments on commit 4777b7a

Please sign in to comment.