server-side-test.js revision ece5a262d20a50d0abf584d0f7ec73929ede9cfd
2362N/A * The contents of this file are subject to the terms of the Common Development and 0N/A * Distribution License (the License). You may not use this file except in compliance with the 2362N/A * specific language governing permission and limitations under the License. 2362N/A * When distributing Covered Software, include this CDDL Header Notice in each file and include 0N/A * Header, with the fields enclosed by brackets [] replaced by your own identifying 0N/A * information: "Portions copyright [year] [name of copyright owner]". 0N/A * Copyright 2013-2014 ForgeRock AS. 0N/A it(
"should create comparison result with zero penalty points",
function() {
0N/A it(
"should create comparison result with zero penalty points using constant",
function() {
6397N/A it(
"should create comparison result with penalty points and additional info",
function() {
0N/A it(
"should create comparison result with penalty points",
function() {
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() {
it(
"should sort comparison results with descending penalty points",
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 config = {
"penaltyPoints":
10};
it(
"should compare screens with null values",
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 null",
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 current value is null",
function() {
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 strings when stored value is null",
function() {
var currentValue =
"VALUE_A; VALUE_B; VALUE_C; VALUE_D; VALUE_E";
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};
it(
"should compare user agents when both are null",
function () {
var config = {
"ignoreVersion":
true,
"penaltyPoints":
10};
it(
"should compare user agents when current value is null",
function () {
var config = {
"ignoreVersion":
true,
"penaltyPoints":
10};
it(
"should compare user agents when stored value is null",
function () {
var config = {
"ignoreVersion":
true,
"penaltyPoints":
10};
describe(
"GeolocationComparator test suite",
function() {
it(
"should compare location when both locations are null",
function () {
var config = {
"allowedRange":
100,
"penaltyPoints":
111};
it(
"should compare location when both latitudes 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 longitudes 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 location is null",
function () {
var stored = {
"latitude":
2.0,
"longitude":
2.0};
var config = {
"allowedRange":
100,
"penaltyPoints":
111};
it(
"should compare location when current latitude 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 longitude 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 location is null",
function () {
var current = {
"latitude":
2.0,
"longitude":
2.0};
var config = {
"allowedRange":
100,
"penaltyPoints":
111};
it(
"should compare location when stored latitude 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 longitude 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};