<commit_before>var chaisePage = require('../../../utils/chaise.page.js');
var recordSetHelpers = require('../../../utils/recordset-helpers.js');
var fs = require('fs');
var testParams = {
    accommodation_tuple: {
        schemaName: "product-recordset",
        table_name: "accommodation",
        comment: "List of different types of accommodations",
        displayName: "Accommodations",
        title: "Accommodations",
        key: { name: "id", value: "2001", operator: "::gt::"},
        shortest_key_filter: "RID=",
        sortby: "no_of_rooms",
        file_names: ["Accommodations.csv", "accommodation.zip"],
        columns: [
            { title: "Name of Accommodation", value: "<NAME>", type: "text"},
            { title: "Website", value: "<p class=\"ng-scope\"><a href=\"http://www.starwoodhotels.com/sheraton/index.html\">Link to Website</a></p>", type: "text", comment: "A valid url of the accommodation"},
            { title: "User Rating", value: "4.3000", type: "float4"},
            { title: "Number of Rooms", value: "23", type: "int4"},
            { title: "Summary", value: "Sherathon Hotels is an international hotel company with more than 990 locations in 73 countries. The first Radisson Hotel was built in 1909 in Minneapolis, Minnesota, US. It is named after the 17th-century French explorer Pierre-<NAME>.", type: "longtext"},
            { title: "Operational Since", value: "2008-12-09 00:00:00", type: "timestamptz" },
            { title: "Is Luxurious", value: "true", type: "boolean" },
            { title: "json_col", value:JSON.stringify({"name":"testing JSON"},undefined,2), type: "json" },
            { title: "json_col_with_markdown", value: "Status is: delivered"},
            { title: "Category", value: "Hotel", comment: "Type of accommodation ('Resort/Hotel/Motel')"},
            { title: "Type of Facilities", value: "Upscale", comment: "Type of facilities ('Luxury/Upscale/Basic')"},
            { title: "Image Count", value: "#1", comment: "Image Count"},
            { title: "Image Distinct Count", value: "1", comment: "Image Distinct Count"},
            { title: "Min Image ID", value: "1", comment: "Min Image ID"},
            { title: "Max Image ID", value: "1", comment: "Max Image ID"}
        ],
        data: [
            {
                id: 2003,
                no_of_rooms: '15',
                title: "NH Munich Resort",
                website: "http://www.nh-hotels.com/hotels/munich",
                rating: "3.2000",
                summary: "NH Hotels has six resorts in the city of Munich. Very close to Munich Main Train Station -- the train being one of the most interesting choices of transport for travelling around Germany -- is the four-star NH München Deutscher Kaiser Hotel. In addition to the excellent quality of accommodation that it offers, the hotel is located close to Marienplatz, the monumental central square in the city, the Frauenkirche church, Stachus (Karlsplatz) and the Viktualienmarkt. Other places of interest to explore in Munich are the English garden, the spectacular Nymphenburg Palace and the German Museum, a museum of science and technology very much in keeping with the industrial spirit of the city. Do not forget to visit Munich at the end of September and beginning of October, the time for its most famous international festival: Oktoberfest! Beer, sausages, baked knuckles and other gastronomic specialities await you in a festive atmosphere on the grasslands of Theresienwiese. Not to be missed! And with NH Hotels you can choose the hotels in Munich which best suit your travel plans, with free WiFi and the possibility to bring your pets with you.",
                opened_on: "1976-06-15 00:00:00",
                luxurious: "true",
                json_col: JSON.stringify({"name":"testing_json"},undefined,2),
                json_col_with_markdown: "Status is: “delivered”",
                category: "Resort",
                type_of_facilities: "Luxury",
                count_image_id: "#1",
                count_distinct_image_id: "1 distinct",
                min_image_id: "3001",
                max_image_id: "3001"
            },
            {
                id: 2002,
                no_of_rooms: '23',
                title: "Sherathon Hotel",
                website: "http://www.starwoodhotels.com/sheraton/index.html",
                rating: "4.3000",
                summary: "Sherathon Hotels is an international hotel company with more than 990 locations in 73 countries. The first Radisson Hotel was built in 1909 in Minneapolis, Minnesota, US. It is named after the 17th-century French explorer <NAME>.",
                opened_on: "2008-12-09 00:00:00",
                luxurious: "true",
                json_col: JSON.stringify(null,undefined,2),
                json_col_with_markdown: "Status is: “delivered”",
                category: "Hotel",
                type_of_facilities: "Upscale",
                count_image_id: "#4",
                count_distinct_image_id: "4 distinct",
                min_image_id: "3005",
                max_image_id: "30007"
            },
            {
                id: 2004,
                no_of_rooms: '35',
                title: "Super 8 North Hollywood Motel",
                website: "https://www.kayak.com/hotels/Super-8-North-Hollywood-c31809-h40498/2016-06-09/2016-06-10/2guests",
                summary: "Fair Hotel. Close to Universal Studios. Located near shopping areas with easy access to parking. Professional staff and clean rooms. Poorly-maintained rooms.",
                rating: "2.8000",
                opened_on: "2013-06-11 00:00:00",
                luxurious: "false",
                json_col: JSON.stringify({"age": 25,"name": "Testing"},undefined,2),
                json_col_with_markdown: "Status is: “Processing”",
                category: "Motel",
                type_of_facilities: "Basic",
                count_image_id: "#3",
                count_distinct_image_id: "3 distinct",
                min_image_id: "3009",
                max_image_id: "3011"
            },
            {
                id: 4004,
                no_of_rooms: '96',
                title: "Hilton Hotel",
                website: "",
                summary: "Great Hotel. We've got the best prices out of anyone. Stay here to make America great again. Located near shopping areas with easy access to parking. Professional staff and clean rooms. Poorly-maintained rooms.",
                rating: "4.2000",
                opened_on: "2013-06-11 00:00:00",
                luxurious: "true",
                json_col: "9876.3543",
                json_col_with_markdown: "Status is: “Processing”",
                category: "Hotel",
                type_of_facilities: "Upscale",
                count_image_id: "",
                count_distinct_image_id: "",
                min_image_id: "",
                max_image_id: ""
            }
        ],
        sortedData:[
            {
                columnName: "Name of Accommodation",
                rawColumnName: "title",
                columnPosition: 1,
                page1:{
                    asc: ["NH Munich Resort", "Radisson Hotel", "Sherathon Hotel"],
                    desc: ["Super 8 North Hollywood Motel", "Sherathon Hotel", "Sherathon Hotel"]
                },
                page2:{
                    asc: ["Sherathon Hotel", "Super 8 North Hollywood Motel"],
                    desc: ["Radisson Hotel", "NH Munich Resort"]
                }
            },
            {
                columnName: "Number of Rooms",
                rawColumnName: "no_of_rooms",
                columnPosition: 4,
                page1:{
                    asc: ["15", "23", "23", ],
                    desc: ["46", "35", "23"]
                },
                page2:{
                    asc: ["35", "46"],
                    desc: ["23", "15"]
                }
            },
            {
                columnName: "Operational Since",
                rawColumnName: "opened_on",
                columnPosition: 6,
                page1:{
                    asc: ["1976-06-15 00:00:00", "2002-01-22 00:00:00", "2008-12-09 00:00:00"],
                    desc: ["2013-06-11 00:00:00", "2008-12-09 00:00:00", "2008-12-09 00:00:00"]
                },
                page2:{
                    asc: ["2008-12-09 00:00:00", "2013-06-11 00:00:00"],
                    desc: ["2002-01-22 00:00:00", "1976-06-15 00:00:00"]
                }
            },
            {
                columnName:"Category",
                rawColumnName: "F8V7Ebs7zt7towDneZvefw",
                columnPosition: 10,
                page1:{
                    asc: ["Hotel", "Hotel", "Hotel"],
                    desc: ["Resort", "Motel", "Hotel"]
                },
                page2:{
                    asc: ["Motel", "Resort"],
                    desc: ["Hotel", "Hotel"]
                }
            },
            {
                columnName:"Type of Facilities",
                rawColumnName: "hZ7Jzy0aC3Q3KQqz4DIXTw",
                columnPosition: 11,
                page1:{
                    asc: ["Basic", "Luxury", "Upscale"],
                    desc: ["Upscale", "Upscale", "Upscale"]
                },
                page2:{
                    asc: ["Upscale", "Upscale"],
                    desc: ["Luxury", "Basic"]
                }
            }
        ]
    },
    file_tuple: {
        table_name: "file",
        custom_page_size: 5,
        page_size: 10
    },
    tooltip: {
        exportDropdown: "Click to choose an export format.",
        permalink: "This link stores your search criteria as a URL. Right click and save.",
        actionCol: "Click on the action buttons to view, edit, or delete each record"
    },
    system_columns: {
        table_name: "system-columns",
        compactConfig: ['RCB', 'RMT'],
        detailedCofnig: true,
        compactColumnsSystemColumnsTable: ['RID', 'id', 'text', 'int', 'RCB', 'RMT'],
        detailedColumns: ['RID', 'id', 'text', 'int', 'RCB', 'RMB', 'RCT', 'RMT'],
        compactColumnsPersonTable: ['RID', 'id', 'text', 'RCB', 'RMT'] // no int column because it's the fireogn key link (would be redundent)
    }
};

describe('View recordset,', function() {

    var accommodationParams = testParams.accommodation_tuple,
        fileParams = testParams.file_tuple;

    describe("For table " + accommodationParams.table_name + ",", function() {
<commit_msg>remove RID from lists because it shouldn't show up<commit_after>var chaisePage = require('../../../utils/chaise.page.js');
var recordSetHelpers = require('../../../utils/recordset-helpers.js');
var fs = require('fs');
var testParams = {
    accommodation_tuple: {
        schemaName: "product-recordset",
        table_name: "accommodation",
        comment: "List of different types of accommodations",
        displayName: "Accommodations",
        title: "Accommodations",
        key: { name: "id", value: "2001", operator: "::gt::"},
        shortest_key_filter: "RID=",
        sortby: "no_of_rooms",
        file_names: ["Accommodations.csv", "accommodation.zip"],
        columns: [
            { title: "Name of Accommodation", value: "<NAME>", type: "text"},
            { title: "Website", value: "<p class=\"ng-scope\"><a href=\"http://www.starwoodhotels.com/sheraton/index.html\">Link to Website</a></p>", type: "text", comment: "A valid url of the accommodation"},
            { title: "User Rating", value: "4.3000", type: "float4"},
            { title: "Number of Rooms", value: "23", type: "int4"},
            { title: "Summary", value: "Sherathon Hotels is an international hotel company with more than 990 locations in 73 countries. The first Radisson Hotel was built in 1909 in Minneapolis, Minnesota, US. It is named after the 17th-century French explorer <NAME>.", type: "longtext"},
            { title: "Operational Since", value: "2008-12-09 00:00:00", type: "timestamptz" },
            { title: "Is Luxurious", value: "true", type: "boolean" },
            { title: "json_col", value:JSON.stringify({"name":"testing JSON"},undefined,2), type: "json" },
            { title: "json_col_with_markdown", value: "Status is: delivered"},
            { title: "Category", value: "Hotel", comment: "Type of accommodation ('Resort/Hotel/Motel')"},
            { title: "Type of Facilities", value: "Upscale", comment: "Type of facilities ('Luxury/Upscale/Basic')"},
            { title: "Image Count", value: "#1", comment: "Image Count"},
            { title: "Image Distinct Count", value: "1", comment: "Image Distinct Count"},
            { title: "Min Image ID", value: "1", comment: "Min Image ID"},
            { title: "Max Image ID", value: "1", comment: "Max Image ID"}
        ],
        data: [
            {
                id: 2003,
                no_of_rooms: '15',
                title: "NH Munich Resort",
                website: "http://www.nh-hotels.com/hotels/munich",
                rating: "3.2000",
                summary: "NH Hotels has six resorts in the city of Munich. Very close to Munich Main Train Station -- the train being one of the most interesting choices of transport for travelling around Germany -- is the four-star NH München Deutscher Kaiser Hotel. In addition to the excellent quality of accommodation that it offers, the hotel is located close to Marienplatz, the monumental central square in the city, the Frauenkirche church, Stachus (Karlsplatz) and the Viktualienmarkt. Other places of interest to explore in Munich are the English garden, the spectacular Nymphenburg Palace and the German Museum, a museum of science and technology very much in keeping with the industrial spirit of the city. Do not forget to visit Munich at the end of September and beginning of October, the time for its most famous international festival: Oktoberfest! Beer, sausages, baked knuckles and other gastronomic specialities await you in a festive atmosphere on the grasslands of Theresienwiese. Not to be missed! And with NH Hotels you can choose the hotels in Munich which best suit your travel plans, with free WiFi and the possibility to bring your pets with you.",
                opened_on: "1976-06-15 00:00:00",
                luxurious: "true",
                json_col: JSON.stringify({"name":"testing_json"},undefined,2),
                json_col_with_markdown: "Status is: “delivered”",
                category: "Resort",
                type_of_facilities: "Luxury",
                count_image_id: "#1",
                count_distinct_image_id: "1 distinct",
                min_image_id: "3001",
                max_image_id: "3001"
            },
            {
                id: 2002,
                no_of_rooms: '23',
                title: "Sherathon Hotel",
                website: "http://www.starwoodhotels.com/sheraton/index.html",
                rating: "4.3000",
                summary: "Sherathon Hotels is an international hotel company with more than 990 locations in 73 countries. The first Radisson Hotel was built in 1909 in Minneapolis, Minnesota, US. It is named after the 17th-century French explorer <NAME>.",
                opened_on: "2008-12-09 00:00:00",
                luxurious: "true",
                json_col: JSON.stringify(null,undefined,2),
                json_col_with_markdown: "Status is: “delivered”",
                category: "Hotel",
                type_of_facilities: "Upscale",
                count_image_id: "#4",
                count_distinct_image_id: "4 distinct",
                min_image_id: "3005",
                max_image_id: "30007"
            },
            {
                id: 2004,
                no_of_rooms: '35',
                title: "Super 8 North Hollywood Motel",
                website: "https://www.kayak.com/hotels/Super-8-North-Hollywood-c31809-h40498/2016-06-09/2016-06-10/2guests",
                summary: "Fair Hotel. Close to Universal Studios. Located near shopping areas with easy access to parking. Professional staff and clean rooms. Poorly-maintained rooms.",
                rating: "2.8000",
                opened_on: "2013-06-11 00:00:00",
                luxurious: "false",
                json_col: JSON.stringify({"age": 25,"name": "Testing"},undefined,2),
                json_col_with_markdown: "Status is: “Processing”",
                category: "Motel",
                type_of_facilities: "Basic",
                count_image_id: "#3",
                count_distinct_image_id: "3 distinct",
                min_image_id: "3009",
                max_image_id: "3011"
            },
            {
                id: 4004,
                no_of_rooms: '96',
                title: "Hilton Hotel",
                website: "",
                summary: "Great Hotel. We've got the best prices out of anyone. Stay here to make America great again. Located near shopping areas with easy access to parking. Professional staff and clean rooms. Poorly-maintained rooms.",
                rating: "4.2000",
                opened_on: "2013-06-11 00:00:00",
                luxurious: "true",
                json_col: "9876.3543",
                json_col_with_markdown: "Status is: “Processing”",
                category: "Hotel",
                type_of_facilities: "Upscale",
                count_image_id: "",
                count_distinct_image_id: "",
                min_image_id: "",
                max_image_id: ""
            }
        ],
        sortedData:[
            {
                columnName: "Name of Accommodation",
                rawColumnName: "title",
                columnPosition: 1,
                page1:{
                    asc: ["NH Munich Resort", "Radisson Hotel", "Sherathon Hotel"],
                    desc: ["Super 8 North Hollywood Motel", "Sherathon Hotel", "Sherathon Hotel"]
                },
                page2:{
                    asc: ["Sherathon Hotel", "Super 8 North Hollywood Motel"],
                    desc: ["Radisson Hotel", "NH Munich Resort"]
                }
            },
            {
                columnName: "Number of Rooms",
                rawColumnName: "no_of_rooms",
                columnPosition: 4,
                page1:{
                    asc: ["15", "23", "23", ],
                    desc: ["46", "35", "23"]
                },
                page2:{
                    asc: ["35", "46"],
                    desc: ["23", "15"]
                }
            },
            {
                columnName: "Operational Since",
                rawColumnName: "opened_on",
                columnPosition: 6,
                page1:{
                    asc: ["1976-06-15 00:00:00", "2002-01-22 00:00:00", "2008-12-09 00:00:00"],
                    desc: ["2013-06-11 00:00:00", "2008-12-09 00:00:00", "2008-12-09 00:00:00"]
                },
                page2:{
                    asc: ["2008-12-09 00:00:00", "2013-06-11 00:00:00"],
                    desc: ["2002-01-22 00:00:00", "1976-06-15 00:00:00"]
                }
            },
            {
                columnName:"Category",
                rawColumnName: "F8V7Ebs7zt7towDneZvefw",
                columnPosition: 10,
                page1:{
                    asc: ["Hotel", "Hotel", "Hotel"],
                    desc: ["Resort", "Motel", "Hotel"]
                },
                page2:{
                    asc: ["Motel", "Resort"],
                    desc: ["Hotel", "Hotel"]
                }
            },
            {
                columnName:"Type of Facilities",
                rawColumnName: "hZ7Jzy0aC3Q3KQqz4DIXTw",
                columnPosition: 11,
                page1:{
                    asc: ["Basic", "Luxury", "Upscale"],
                    desc: ["Upscale", "Upscale", "Upscale"]
                },
                page2:{
                    asc: ["Upscale", "Upscale"],
                    desc: ["Luxury", "Basic"]
                }
            }
        ]
    },
    file_tuple: {
        table_name: "file",
        custom_page_size: 5,
        page_size: 10
    },
    tooltip: {
        exportDropdown: "Click to choose an export format.",
        permalink: "This link stores your search criteria as a URL. Right click and save.",
        actionCol: "Click on the action buttons to view, edit, or delete each record"
    },
    system_columns: {
        table_name: "system-columns",
        compactConfig: ['RCB', 'RMT'],
        detailedCofnig: true,
        compactColumnsSystemColumnsTable: ['id', 'text', 'int', 'RCB', 'RMT'],
        detailedColumns: ['RID', 'id', 'text', 'int', 'RCB', 'RMB', 'RCT', 'RMT'],
        compactColumnsPersonTable: ['id', 'text', 'RCB', 'RMT'] // no int column because it's the fireogn key link (would be redundent)
    }
};

describe('View recordset,', function() {

    var accommodationParams = testParams.accommodation_tuple,
        fileParams = testParams.file_tuple;

    describe("For table " + accommodationParams.table_name + ",", function() {

{'fraction_non_alphanumeric': 0.12195584194068038, 'fraction_numerical': 0.039609589690135505, 'mean_word_length': 1.8052897395002658, 'pattern_counts': {'":': 10, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5713191', 'n_tokens_mistral': 6574, 'n_tokens_neox': 5708, 'n_words': 1746}