<commit_before>/* eslint max-nested-callbacks: [2, 5] no-unused-expressions:0, no-unused-vars:0*/

"use strict";
import FeedDb from "../../../src/js/feeds/db/FeedDb.js";
import PouchClient from "../../../src/js/db/PouchClient";
import FeedApplicationQueries from "../../../src/js/feeds/db/FeedApplicationQueries.js";
import sinon from "sinon";
import { expect, assert } from "chai";

describe("FeedApplicationQueries", () => {
    describe("allFeedsWithCategoryNames", () => {
        it("should fetch all surf feeds and return with category name", () => {
            let resultDocs = [
                {
                    "key": "fbId1",
                    "id": "fbId1",
                    "value": {
                    "_id": "sportsCategoryId1"
                },
                    "doc": {
                    "docType": "category",
                    "name": "Sports",
                    "_id": "sportsCategoryId1",
                    "_rev": "1-4b61e9edacc78ab1f189b68345d4d410"
                }
                }, {
                "key": "2015-10-03T04:09:17+00:00",
                "id": "feedId1",
                "value": "rssId1",
                "doc": {
                    "docType": "feed",
                    "title": "tn",
                    "description": "www.facebookpolitics.com",
                    "sourceId": "rssId1",
                    "postedDate": "2015-10-03T04:09:17+00:00",
                    "_id": "feedId1",
                    "_rev": "1-e41ef125b2f5fbef4f20d8c896eeea53"
                }
            }, {
                "key": "rssId1",
                "id": "rssId1",
                "value": {
                    "_id": "sportsCategoryId1"
                },
                "doc": {
                    "docType": "category",
                    "name": "Sports",
                    "_id": "sportsCategoryId1",
                    "_rev": "1-4b61e9edacc78ab1f189b68345d4d410"
                }
            }, {
                "key": "rssId1",
                "id": "rssId1",
                "value": {
                    "_id": "politicsCategoryId2"
                },
                "doc": {
                    "docType": "category",
                    "name": "Politics",
                    "_id": "politicsCategoryId2",
                    "_rev": "1-175853337b49fcd1db6474777f871d4a"
                }
            }, {
                "key": "noCategoryUrl",
                "id": "test1",
                "value": {
                    "_id": "politicsCategoryId2"
                },
                "doc": {
                        "docType": "category",
                        "name": "noCategoryUrl",
                        "_id": "politicsCategoryId2",
                        "_rev": "1-175853337b49fcd1db6474777f871d4a"
                    }
            }, {
                "key": "2015-10-04T04:09:17+00:00",
                "id": "test1",
                "value": "noCategoryUrl",
                "doc": {
                    "docType": "feed",
                    "title": "test title",
                    "description": "www.facebooksports.com",
                    "sourceId": "noCategoryUrl",
                    "postedDate": "2015-10-04T04:09:17+00:00",
                    "_id": "feed2",
                    "_rev": "1-e41ef125b2f5fbef4f20d8c896eeea53"
                }
            }
            ];


            let expectedSources = [
                {
                    "docType": "feed",
                    "title": "tn",
                    "description": "www.facebookpolitics.com",
                    "sourceId": "rssId1",
                    "postedDate": "2015-10-03T04:09:17+00:00",
                    "_id": "feedId1",
                    "_rev": "1-e41ef125b2f5fbef4f20d8c896eeea53",
                    "categoryNames": ["Sports", "Politics"]
                }, {
                "docType": "feed",
                "title": "test title",
                "description": "www.facebooksports.com",
                "sourceId": "noCategoryUrl",
                "postedDate": "2015-10-04T04:09:17+00:00",
                "_id": "feed2",
                "_rev": "1-e41ef125b2f5fbef4f20d8c896eeea53",
                "categoryNames": ["noCategoryUrl"]
            }
            ];
<commit_msg>#241[Swetha] Fixed eslint errors]<commit_after>/* eslint max-nested-callbacks: [2, 5] no-unused-expressions:0, no-unused-vars:0*/

"use strict";
import FeedDb from "../../../src/js/feeds/db/FeedDb.js";
import PouchClient from "../../../src/js/db/PouchClient";
import FeedApplicationQueries from "../../../src/js/feeds/db/FeedApplicationQueries.js";
import sinon from "sinon";
import { expect, assert } from "chai";

describe("FeedApplicationQueries", () => {
    describe("allFeedsWithCategoryNames", () => {
        it("should fetch all surf feeds and return with category name", () => {
            let resultDocs = [
                {
                    "key": "fbId1",
                    "id": "fbId1",
                    "value": {
                        "_id": "sportsCategoryId1"
                    },
                    "doc": {
                        "docType": "category",
                        "name": "Sports",
                        "_id": "sportsCategoryId1",
                        "_rev": "1-4b61e9edacc78ab1f189b68345d4d410"
                    }
                }, {
                    "key": "2015-10-03T04:09:17+00:00",
                    "id": "feedId1",
                    "value": "rssId1",
                    "doc": {
                        "docType": "feed",
                        "title": "tn",
                        "description": "www.facebookpolitics.com",
                        "sourceId": "rssId1",
                        "postedDate": "2015-10-03T04:09:17+00:00",
                        "_id": "feedId1",
                        "_rev": "1-e41ef125b2f5fbef4f20d8c896eeea53"
                    }
                }, {
                    "key": "rssId1",
                    "id": "rssId1",
                    "value": {
                        "_id": "sportsCategoryId1"
                    },
                    "doc": {
                        "docType": "category",
                        "name": "Sports",
                        "_id": "sportsCategoryId1",
                        "_rev": "1-4b61e9edacc78ab1f189b68345d4d410"
                    }
                }, {
                    "key": "rssId1",
                    "id": "rssId1",
                    "value": {
                        "_id": "politicsCategoryId2"
                    },
                    "doc": {
                        "docType": "category",
                        "name": "Politics",
                        "_id": "politicsCategoryId2",
                        "_rev": "1-175853337b49fcd1db6474777f871d4a"
                    }
                }, {
                    "key": "noCategoryUrl",
                    "id": "test1",
                    "value": {
                        "_id": "politicsCategoryId2"
                    },
                    "doc": {
                        "docType": "category",
                        "name": "noCategoryUrl",
                        "_id": "politicsCategoryId2",
                        "_rev": "1-175853337b49fcd1db6474777f871d4a"
                    }
                }, {
                    "key": "2015-10-04T04:09:17+00:00",
                    "id": "test1",
                    "value": "noCategoryUrl",
                    "doc": {
                        "docType": "feed",
                        "title": "test title",
                        "description": "www.facebooksports.com",
                        "sourceId": "noCategoryUrl",
                        "postedDate": "2015-10-04T04:09:17+00:00",
                        "_id": "feed2",
                        "_rev": "1-e41ef125b2f5fbef4f20d8c896eeea53"
                    }
                }
            ];


            let expectedSources = [
                {
                    "docType": "feed",
                    "title": "tn",
                    "description": "www.facebookpolitics.com",
                    "sourceId": "rssId1",
                    "postedDate": "2015-10-03T04:09:17+00:00",
                    "_id": "feedId1",
                    "_rev": "1-e41ef125b2f5fbef4f20d8c896eeea53",
                    "categoryNames": ["Sports", "Politics"]
                }, {
                    "docType": "feed",
                    "title": "test title",
                    "description": "www.facebooksports.com",
                    "sourceId": "noCategoryUrl",
                    "postedDate": "2015-10-04T04:09:17+00:00",
                    "_id": "feed2",
                    "_rev": "1-e41ef125b2f5fbef4f20d8c896eeea53",
                    "categoryNames": ["noCategoryUrl"]
                }
            ];

{'fraction_non_alphanumeric': 0.14035481697731866, 'fraction_numerical': 0.06591062205254884, 'mean_word_length': 1.0133363471971066, 'pattern_counts': {'":': 148, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '1454198', 'n_tokens_mistral': 2892, 'n_tokens_neox': 2424, 'n_words': 377}