<commit_before>import "./data.module";
import {NGMock} from "../../../ng.mockhelper";
import {DataLoadingService} from "./data.loading.service";
import {TEST_FILE_CONTENT} from "./data.mocks";

/**
 * @test {DataLoadingService}
 */
describe("app.codeCharta.core.data.dataLoadingService", function () {

    let dataLoadingService: DataLoadingService,
        validFileContent;

    //noinspection TypeScriptUnresolvedVariable
    beforeEach(NGMock.mock.module("app.codeCharta.core.data"));
    //noinspection TypeScriptUnresolvedVariable
    beforeEach(NGMock.mock.inject(function (_dataLoadingService_) {
        dataLoadingService = _dataLoadingService_;
        validFileContent = TEST_FILE_CONTENT;
    }));

    it("should resolve valid file", ()=> {
        return dataLoadingService.loadMapFromFileContent("file.json", validFileContent, 0);
    });

    it("should reject or catch invalid file", (done)=> {
        let invalidFileContent = validFileContent;
        delete invalidFileContent.projectName;
        dataLoadingService.loadMapFromFileContent("file.json", invalidFileContent, 0).then(()=>{}, ()=>{
            done();
        }).catch(()=>{
            done()
        });
    });

});

<commit_msg>adding loading tests<commit_after>import "./data.module";
import {NGMock} from "../../../ng.mockhelper";
import {DataLoadingService} from "./data.loading.service";
import {TEST_FILE_CONTENT} from "./data.mocks";

/**
 * @test {DataLoadingService}
 */
describe("app.codeCharta.core.data.dataLoadingService", function () {

    let dataLoadingService: DataLoadingService,
        validFileContent;

    //noinspection TypeScriptUnresolvedVariable
    beforeEach(NGMock.mock.module("app.codeCharta.core.data"));
    //noinspection TypeScriptUnresolvedVariable
    beforeEach(NGMock.mock.inject(function (_dataLoadingService_) {
        dataLoadingService = _dataLoadingService_;
        validFileContent = TEST_FILE_CONTENT;
    }));


    it("should load a file without dependencies", ()=> {
        validFileContent.dependencies = undefined;
        return dataLoadingService.loadMapFromFileContent("file.json", validFileContent, 0);
    });

    it("should resolve valid file", ()=> {
        return dataLoadingService.loadMapFromFileContent("file.json", validFileContent, 0);
    });

    it("should reject or catch invalid file", (done)=> {
        let invalidFileContent = validFileContent;
        delete invalidFileContent.projectName;
        dataLoadingService.loadMapFromFileContent("file.json", invalidFileContent, 0).then(()=>{}, ()=>{
            done();
        }).catch(()=>{
            done()
        });
    });

});


{'fraction_non_alphanumeric': 0.14032440588457187, 'fraction_numerical': 0.001886080724254998, 'mean_word_length': 3.5724137931034483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '2015579', 'n_tokens_mistral': 733, 'n_tokens_neox': 720, 'n_words': 132}