<commit_before>import {sum} from "./__mocks__/sum";
import {functionFuzzer, FunctionFuzzerFactory} from "./FunctionFuzzerFactory";

describe("FunctionFuzzerFactory", () => {
    const sumFuzzerFactory: any = functionFuzzer(sum);

    test("functionFuzzer should create function fuzzer instance", () => {
        expect(sumFuzzerFactory instanceof FunctionFuzzerFactory).toBe(true);
    });

    test("functionFuzzer should create fuzzer with internal func", () => {
        expect(sumFuzzerFactory.func).toBe(sum);
    });
});<commit_msg>[up] 0.6.2 - add tests for fuzzer creation<commit_after>import {FunctionFuzzer} from "../fuzzer/functionFuzzer";
import {sum} from "./__mocks__/sum";
import {functionFuzzer, FunctionFuzzerFactory} from "./FunctionFuzzerFactory";

describe("FunctionFuzzerFactory", () => {
    const sumFuzzerFactory = functionFuzzer(sum);

    test("functionFuzzer should create function fuzzer instance", () => {
        expect(sumFuzzerFactory instanceof FunctionFuzzerFactory).toBe(true);
    });

    test("functionFuzzer should create fuzzer with internal func", () => {
        expect((sumFuzzerFactory as any).func).toBe(sum);
    });

    test("factory methods should creates fuzzer without error", () => {
        const methodNames: Array<keyof FunctionFuzzerFactory> = [
            "boolean", "booleanArray", "number", "numberArray", "string", "stringArray", "all",
        ];

        methodNames.forEach((method) => {
            expect((sumFuzzerFactory as any)[method]() instanceof FunctionFuzzer).toBe(true);
            expect(() => (sumFuzzerFactory as any)[method]()).not.toThrow();
        });
    });
});
{'fraction_non_alphanumeric': 0.14580801944106925, 'fraction_numerical': 0.0018226002430133657, 'mean_word_length': 4.130841121495327, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 13, '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': '6337865', 'n_tokens_mistral': 486, 'n_tokens_neox': 475, 'n_words': 101}