Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.

Fixed bug #1, and added unit test for bug scenario. #2

Merged
merged 2 commits into from
Oct 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/areSameQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ function areSameQuery(queryObj1, queryObj2)
// If strings don't match
if (value1 !== value2)
{
// Only other type allowed is Array
// Don't proceed unless both are arrays
// "?var1=a&var1=b" would've been parsed to { var1: ["a","b"] }
if (Array.isArray(value1) !== Array.isArray(value2)) return false;
if (Array.isArray(value1)===false || Array.isArray(value2)===false) return false;

len = value1.length;

Expand Down
4 changes: 4 additions & 0 deletions test/0.independent.areSameQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ describe("areSameQuery", function()
query2 = {};
expect( areSameQuery(query1,query2) ).to.be.true;

query1 = { var1:"123" };
query2 = { var1:"456" };
expect( areSameQuery(query1,query2) ).to.be.false;

done();
});
});