server-side-test.js revision 67d4b8e0d7b2401ae02cde1c197df565239df882
5300N/A * The contents of this file are subject to the terms of the Common Development and 5300N/A * Distribution License (the License). You may not use this file except in compliance with the 5300N/A * specific language governing permission and limitations under the License. 5300N/A * When distributing Covered Software, include this CDDL Header Notice in each file and include 5300N/A * Header, with the fields enclosed by brackets [] replaced by your own identifying 5300N/A * information: "Portions copyright [year] [name of copyright owner]". 5300N/A * Copyright 2013-2014 ForgeRock AS. 5300N/A it(
"should create comparison result with zero penalty points",
function() {
5300N/A it(
"should create comparison result with zero penalty points using constant",
function() {
5300N/A it(
"should create comparison result with penalty points and additional info",
function() {
5300N/A it(
"should create comparison result with penalty points",
function() {
5300N/A it(
"should create comparison result with additional info",
function() {
it(
"should add comparison result",
function() {
it(
"should get comparison result successful",
function() {
it(
"should get comparison result unsuccessful",
function() {
it(
"should compare comparison results equally",
function() {
it(
"should compare comparison results not equal penalty points",
function() {
it(
"should compare comparison results with equal penalty points but one with additional info",
function() {
it(
"should compare comparison results with null",
function() {
describe(
"ScalarComparator test suite",
function() {
it(
"should compare with no penalty points",
function () {
var config = {
"penaltyPoints":
0};
it(
"should compare when stored value is different to current value",
function () {
var config = {
"penaltyPoints":
10};
it(
"should compare when stored value is not null and current value is null",
function () {
var config = {
"penaltyPoints":
10};
it(
"should compare when stored value is null and current value is not null",
function () {
var config = {
"penaltyPoints":
10};
describe(
"ScreenComparator test suite",
function() {
it(
"should compare screens that are equal",
function() {
var currentValue = {
"screenWidth":
1920,
"screenHeight":
1200,
"screenColourDepth":
24};
var storedValue = {
"screenWidth":
1920,
"screenHeight":
1200,
"screenColourDepth":
24};
var config = {
"penaltyPoints":
10};
it(
"should compare screens that are null",
function() {
var currentValue = {
"screenWidth":
null,
"screenHeight":
null,
"screenColourDepth":
null};
var storedValue = {
"screenWidth":
null,
"screenHeight":
null,
"screenColourDepth":
null};
var config = {
"penaltyPoints":
10};
it(
"should compare screens when stored screen width is null",
function() {
var currentValue = {
"screenWidth":
1920,
"screenHeight":
1200,
"screenColourDepth":
24};
var storedValue = {
"screenWidth":
null,
"screenHeight":
1200,
"screenColourDepth":
24};
var config = {
"penaltyPoints":
10};
it(
"should compare screens when stored screen width is different to current screen width",
function() {
var currentValue = {
"screenWidth":
800,
"screenHeight":
1200,
"screenColourDepth":
24};
var storedValue = {
"screenWidth":
1920,
"screenHeight":
1200,
"screenColourDepth":
24};
var config = {
"penaltyPoints":
10};
it(
"should compare screens when stored screen height is null",
function() {
var currentValue = {
"screenWidth":
1920,
"screenHeight":
1200,
"screenColourDepth":
24};
var storedValue = {
"screenWidth":
1920,
"screenHeight":
null,
"screenColourDepth":
24};
var config = {
"penaltyPoints":
10};
it(
"should compare screens when stored screen height is different to current screen height",
function() {
var currentValue = {
"screenWidth":
1920,
"screenHeight":
800,
"screenColourDepth":
24};
var storedValue = {
"screenWidth":
1920,
"screenHeight":
1200,
"screenColourDepth":
24};
var config = {
"penaltyPoints":
10};
it(
"should compare screens when stored screen colour depth is null",
function() {
var currentValue = {
"screenWidth":
1920,
"screenHeight":
1200,
"screenColourDepth":
24};
var storedValue = {
"screenWidth":
1920,
"screenHeight":
1200,
"screenColourDepth":
null};
var config = {
"penaltyPoints":
10};
it(
"should compare screens when stored screen colour depth is different to current screen colour depth",
function() {
var currentValue = {
"screenWidth":
1920,
"screenHeight":
1200,
"screenColourDepth":
16};
var storedValue = {
"screenWidth":
1920,
"screenHeight":
1200,
"screenColourDepth":
24};
var config = {
"penaltyPoints":
10};
describe(
"MultiValueComparator test suite",
function() {
it(
"should compare multi value strings when stored value is null and current value is empty",
function() {
var config = {
"maxPercentageDifference":
20,
"maxDifferences":
1,
"penaltyPoints":
111};
it(
"should compare multi value strings when both are empty",
function() {
var config = {
"maxPercentageDifference":
20,
"maxDifferences":
1,
"penaltyPoints":
111};
it(
"should compare multi value strings when both are equal",
function() {
var currentValue =
"VALUE_A; VALUE_B; VALUE_C; VALUE_D; VALUE_E";
var storedValue =
"VALUE_A; VALUE_B; VALUE_C; VALUE_D; VALUE_E";
var config = {
"maxPercentageDifference":
20,
"maxDifferences":
1,
"penaltyPoints":
111};
it(
"should compare multi value string when there are less differences than max",
function() {
var currentValue =
"VALUE_AA; VALUE_B; VALUE_C; VALUE_D; VALUE_E";
var storedValue =
"VALUE_B; VALUE_C; VALUE_D; VALUE_E";
var config = {
"maxPercentageDifference":
20,
"maxDifferences":
1,
"penaltyPoints":
111};
it(
"should compare multi value string when there are more differences than max",
function() {
var currentValue =
"VALUE_AA; VALUE_BB; VALUE_C; VALUE_D; VALUE_E";
var storedValue =
"VALUE_B; VALUE_C; VALUE_D; VALUE_E";
var config = {
"maxPercentageDifference":
20,
"maxDifferences":
1,
"penaltyPoints":
111};
it(
"should compare multi value string when there is less percentage diff than max",
function() {
var currentValue =
"VALUE_AA; VALUE_B; VALUE_C; VALUE_D; VALUE_E";
var storedValue =
"VALUE_B; VALUE_C; VALUE_D; VALUE_E";
var config = {
"maxPercentageDifference":
20,
"maxDifferences":
1,
"penaltyPoints":
111};
it(
"should compare multi value string when there is more percentage diff than max",
function() {
var currentValue =
"VALUE_AA; VALUE_BB; VALUE_C; VALUE_D; VALUE_E";
var storedValue =
"VALUE_B; VALUE_C; VALUE_D; VALUE_E";
var config = {
"maxPercentageDifference":
20,
"maxDifferences":
1,
"penaltyPoints":
111};
describe(
"UserAgentComparator test suite",
function() {
it(
"should compare user agents",
function () {
var config = {
"ignoreVersion":
false,
"penaltyPoints":
10};
it(
"should compare user agents ignoring version numbers",
function () {
var config = {
"ignoreVersion":
true,
"penaltyPoints":
10};
describe(
"GeolocationComparator test suite",
function() {
it(
"should compare location when both Xs are null",
function () {
var current = {
"latitude":
null,
"longitude":
2.0};
var stored = {
"latitude":
null,
"longitude":
2.0};
var config = {
"allowedRange":
100,
"penaltyPoints":
111};
it(
"should compare location when both Ys are null",
function () {
var current = {
"latitude":
2.0,
"longitude":
null};
var stored = {
"latitude":
2.0,
"longitude":
null};
var config = {
"allowedRange":
100,
"penaltyPoints":
111};
it(
"should compare location when current X is null",
function () {
var current = {
"latitude":
null,
"longitude":
2.0};
var stored = {
"latitude":
2.0,
"longitude":
2.0};
var config = {
"allowedRange":
100,
"penaltyPoints":
111};
it(
"should compare location when current Y is null",
function () {
var current = {
"latitude":
2.0,
"longitude":
null};
var stored = {
"latitude":
2.0,
"longitude":
2.0};
var config = {
"allowedRange":
100,
"penaltyPoints":
111};
it(
"should compare location when stored X is null",
function () {
var current = {
"latitude":
2.0,
"longitude":
2.0};
var stored = {
"latitude":
null,
"longitude":
2.0};
var config = {
"allowedRange":
100,
"penaltyPoints":
111};
it(
"should compare location when stored Y is null",
function () {
var current = {
"latitude":
2.0,
"longitude":
2.0};
var stored = {
"latitude":
2.0,
"longitude":
null};
var config = {
"allowedRange":
100,
"penaltyPoints":
111};
it(
"should compare locations that are equal",
function () {
var current = {
"latitude":
2.0,
"longitude":
2.0};
var stored = {
"latitude":
2.0,
"longitude":
2.0};
var config = {
"allowedRange":
100,
"penaltyPoints":
111};
it(
"should compare locations that are within tolerable range",
function () {
var current = {
"latitude":
3.0,
"longitude":
3.0};
var stored = {
"latitude":
2.0,
"longitude":
2.0};
var config = {
"allowedRange":
100,
"penaltyPoints":
111};
it(
"should compare locations that are outside tolerable range",
function () {
var current = {
"latitude":
20.0,
"longitude":
20.0};
var stored = {
"latitude":
2.0,
"longitude":
2.0};
var config = {
"allowedRange":
100,
"penaltyPoints":
111};