<commit_before>import { assert } from 'chai';
import {QueryStore, normalizeQuery} from "./QueryStore";
import {nonMolecularProfileParams} from "./QueryStoreUtils";

describe('QueryStoreUtils', ()=>{
    describe('nonMolecularProfileParams', ()=>{
        it("returns normalized query for gene_list parameter", ()=>{
            let store = new QueryStore();
            let queries = [
                "TP53:MUT",
                "tp53:mut",
                "TP53:mut",
                "TP53:exp>0",
                "PIM2: exp > 0",
                "TP53: EXP<=0",
                "TP53: MUT; PTEN:amp"
            ];
            for (let query of queries) {
                store.geneQuery = query;
                assert.equal(nonMolecularProfileParams(store).gene_list, normalizeQuery(query), `got normalized query for query ${query}`);
            }
        });
    });
});<commit_msg>fix queryStore window reference for test<commit_after>import { assert } from 'chai';
import {QueryStore, normalizeQuery} from "./QueryStore";
import {nonMolecularProfileParams} from "./QueryStoreUtils";
import Sinon from 'sinon';

describe('QueryStoreUtils', ()=>{
    describe('nonMolecularProfileParams', ()=>{

        let addParamStub: any

        before(()=>{
            addParamStub = Sinon.stub(QueryStore.prototype, "addParamsFromWindow");
        });

        after(()=>{
            addParamStub.restore();
        });

        it("returns normalized query for gene_list parameter", ()=>{


            let store = new QueryStore();

            let queries = [
                "TP53:MUT",
                "tp53:mut",
                "TP53:mut",
                "TP53:exp>0",
                "PIM2: exp > 0",
                "TP53: EXP<=0",
                "TP53: MUT; PTEN:amp"
            ];
            for (let query of queries) {
                store.geneQuery = query;
                assert.equal(nonMolecularProfileParams(store).gene_list, normalizeQuery(query), `got normalized query for query ${query}`);
            }
        });
    });
});
{'fraction_non_alphanumeric': 0.1368062317429406, 'fraction_numerical': 0.01557935735150925, 'mean_word_length': 1.9107648725212465, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '7481973', 'n_tokens_mistral': 603, 'n_tokens_neox': 547, 'n_words': 126}