<commit_before>import {assert} from 'chai';
import sinon from 'sinon';
import SampleManager from './SampleManager';
import TumorColumnFormatter from './mutation/column/TumorColumnFormatter';
import { checkNonProfiledGenesExist } from './PatientViewPageUtils';
import { PatientViewPageStore } from './clinicalInformation/PatientViewPageStore';
import { ClinicalDataBySampleId } from 'shared/api/api-types-extended';

describe('PatientViewPageUtils', () => {

    describe('checkNonProfiledGenesExist()', () => {

        const sampleIds = ['sampleA', 'sampleB'];
        const entrezGeneIds = [1, 2, 3];
        
        const stub = sinon.stub(TumorColumnFormatter, 'getProfiledSamplesForGene');

        it('returns false when all samples have been profiled', () => {

            const allSamplesProfiled = {
                sampleA: true,
                sampleB: true,
            };

            stub.returns(allSamplesProfiled);
            assert.isFalse(checkNonProfiledGenesExist(sampleIds, entrezGeneIds, {} as any, {} as any));

        });

        it('returns true when a sample has not been not profiled', () => {

            const oneSampleNotProfiled = {
                sampleA: true,
                sampleB: false,
            };

            stub.returns(oneSampleNotProfiled);
            assert.isTrue(checkNonProfiledGenesExist(sampleIds, entrezGeneIds, {} as any, {} as any));

        });

    });
<commit_msg>Reset stub after use.<commit_after>import {assert} from 'chai';
import sinon from 'sinon';
import SampleManager from './SampleManager';
import TumorColumnFormatter from './mutation/column/TumorColumnFormatter';
import { checkNonProfiledGenesExist } from './PatientViewPageUtils';
import { PatientViewPageStore } from './clinicalInformation/PatientViewPageStore';
import { ClinicalDataBySampleId } from 'shared/api/api-types-extended';

describe('PatientViewPageUtils', () => {

    describe('checkNonProfiledGenesExist()', () => {

        const sampleIds = ['sampleA', 'sampleB'];
        const entrezGeneIds = [1, 2, 3];

        const stub = sinon.stub(TumorColumnFormatter, 'getProfiledSamplesForGene');
        
        after(() => {
            stub.restore();
        });

        it('returns false when all samples have been profiled', () => {

            const allSamplesProfiled = {
                sampleA: true,
                sampleB: true,
            };

            stub.returns(allSamplesProfiled);
            assert.isFalse(checkNonProfiledGenesExist(sampleIds, entrezGeneIds, {} as any, {} as any));

        });

        it('returns true when a sample has not been not profiled', () => {

            const oneSampleNotProfiled = {
                sampleA: true,
                sampleB: false,
            };

            stub.returns(oneSampleNotProfiled);
            assert.isTrue(checkNonProfiledGenesExist(sampleIds, entrezGeneIds, {} as any, {} as any));

        });

    });

{'fraction_non_alphanumeric': 0.11824668705402651, 'fraction_numerical': 0.0020387359836901123, 'mean_word_length': 2.625615763546798, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '2646538', 'n_tokens_mistral': 870, 'n_tokens_neox': 783, 'n_words': 179}