Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

636 B
Raw Blame
"use strict";

var { expect } = require("chai");
var { parseQuery } = require("../../lib/browser/parse-query.js");

describe("parseQuery()", function () {
  it("should get queryString and return key-value object", function () {
    expect(parseQuery("?foo=1&bar=2&baz=3")).to.deep.equal({
      foo: "1",
      bar: "2",
      baz: "3",
    });

    expect(parseQuery("?r1=^@(?!.*\\)$)&r2=m{2}&r3=^co.*")).to.deep.equal({
      r1: "^@(?!.*\\)$)",
      r2: "m{2}",
      r3: "^co.*",
    });
  });

  it('should parse "+" as a space', function () {
    expect(parseQuery("?grep=foo+bar")).to.deep.equal({ grep: "foo bar" });
  });
});