{"size": 790, "ext": "js", "max_stars_repo_path": "core/algorithm-builder/tests/textTests.js", "max_stars_repo_name": "devhliu/hkube", "max_stars_repo_stars_event_min_datetime": "2017-11-30T21:44:48.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-28T10:40:54.000Z", "max_issues_repo_path": "core/algorithm-builder/tests/textTests.js", "max_issues_repo_name": "OAKO-UCONN/hkube", "max_issues_repo_issues_event_min_datetime": "2017-11-23T10:03:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T07:49:18.000Z", "max_forks_repo_path": "core/algorithm-builder/tests/textTests.js", "max_forks_repo_name": "yehiyam/hkube-stam", "max_forks_repo_forks_event_min_datetime": "2017-12-24T09:19:51.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-26T05:20:11.000Z"}
{"max_stars_count": 275, "max_issues_count": 1024, "max_forks_count": 21, "avg_line_length": 34.347826087, "max_line_length": 77, "alphanum_fraction": 0.5544303797}
const { expect } = require('chai');
const {redactLines} = require('../lib/utils/text');
const fs = require('fs')
const inputFile = fs.readFileSync(__dirname + '/mocks/longLog.json','utf-8');
const inputStr = JSON.parse(inputFile).result.data;
describe('text tests', () => {
    it('redact empty string', () => {
        const str = '';
        const res = redactLines(str);        
        expect(res).to.be.empty
    });
    it('not redact short string', () => {
        const str = 'foo bar';
        const res = redactLines(str);        
        expect(res).to.eql(str)
    });
    it('redact long string', () => {
        const str = inputStr.slice(0,-1);
        const res = redactLines(str);
        const lines = res.split(/\n/);
        expect(lines).to.have.length(503)
    });
});