<commit_before>/* eslint max-nested-callbacks: [2, 5] react/jsx-wrap-multilines:0 */
/* eslint handle-callback-err: 0 no-magic-numbers:0  */
import request from "supertest";
import HttpResponseHandler from "../../common/src/HttpResponseHandler";
import ApplicationConfig from "../src/config/ApplicationConfig";
import { assert, expect } from "chai";
import CouchSession from "../src/CouchSession";

const requestTime = 7000;
describe("RssRoutesSpec", () => {
    describe("RssRoutesSpec", () => {
        let accessToken = null, applicationConfig = null, serverIp = null;
        before("RssRoutesSpec", (done)=> {
            applicationConfig = new ApplicationConfig();
            serverIp = applicationConfig.serverIpAddress() + ":" + applicationConfig.serverPort();
            CouchSession.login("test", "test").then((token) => {
                accessToken = token;
                done();
            });
        });

        it("should return status OK if the url is empty", (done) => {
            request(serverIp)
                .get("/rss-feeds")
                .query("url=")
                .set("Cookie", accessToken)
                .end((err, res) => {
                    assert.strictEqual(HttpResponseHandler.codes.BAD_REQUEST, res.statusCode);
                    done();
                });
        });

        it("should return data if the url is valid", (done) => {
            let expectedValues = {
                "items": [{ "title": "sample1", "description": "news cricket" },<commit_msg>[Dur] - Bug Fixes - fixes server tests<commit_after>/* eslint max-nested-callbacks: [2, 5] react/jsx-wrap-multilines:0 */
/* eslint handle-callback-err: 0 no-magic-numbers:0  */
import request from "supertest";
import HttpResponseHandler from "../../common/src/HttpResponseHandler";
import ApplicationConfig from "../src/config/ApplicationConfig";
import { assert, expect } from "chai";
import CouchSession from "../src/CouchSession";

const requestTime = 7000;
describe("RssRoutesSpec", () => {
    describe("RssRoutesSpec", () => {
        let accessToken = null, applicationConfig = null, serverIp = null;
        before("RssRoutesSpec", (done)=> {
            applicationConfig = new ApplicationConfig();
            serverIp = applicationConfig.serverIpAddress() + ":" + applicationConfig.serverPort();
            CouchSession.login("test", "test").then((token) => {
                accessToken = token;
                done();
            });
        });

        it("should return status OK if the url is empty", (done) => {
            request(serverIp)
                .get("/rss-feeds")
                .query("url=")
                .set("Cookie", accessToken)
                .end((err, res) => {
                    assert.strictEqual(HttpResponseHandler.codes.UNPROCESSABLE_ENTITY, res.statusCode);
                    done();
                });
        });

        it("should return data if the url is valid", (done) => {
            let expectedValues = {
                "items": [{ "title": "sample1", "description": "news cricket" },
{'fraction_non_alphanumeric': 0.1469440832249675, 'fraction_numerical': 0.006501950585175552, 'mean_word_length': 2.238947368421053, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5380837', 'n_tokens_mistral': 845, 'n_tokens_neox': 803, 'n_words': 191}