<commit_before>import 'mocha';
import * as expect from 'expect.js';
import { ImportCreator, ImportElementGroup, ImportStringConfiguration } from '../src/core';

interface ImportCreatorTest {
    testName: string;
    elementGroups: ImportElementGroup[];
    expected: string;
}

suite('Import Creator Tests', () => {

    const stringConfiguration: ImportStringConfiguration = {
        tabSize: 4,
        numberOfEmptyLinesAfterAllImports: 2,
        quoteMark: 'single',
        maximumNumberOfImportExpressionsPerLine: {
            count: 100,
            type: 'maxLineLength'
        },
        spacingPerImportExpression: {
            afterStartingBracket: 1,
            beforeEndingBracket: 1,
            beforeComma: 0,
            afterComma: 1
        }
    };

    const testCases: ImportCreatorTest[] = [
        {
            testName: 'test0',
            elementGroups: [
                {
                    elements: [
                        {
                            moduleSpecifierName: 'createString.ts',
                            startPosition: { line: 0, character: 0 },
                            endPosition: { line: 0, character: 53 },
                            hasFromKeyWord: true,
                            defaultImportName: 't',
                            namedBindings: [
                                { name: 'B', aliasName: null },
                                { name: 'a', aliasName: 'cc' },
                                { name: 'ac', aliasName: null }
                            ]
                        }],
                    numberOfEmptyLinesAfterGroup: 3
                }
            ],
            expected: `import t, {
                B, a as cc, ac
            } from 'createString.ts';

            `
        }
    ];

    const getImportText = (groups: ImportElementGroup[]) => {
        const creator = new ImportCreator();
        creator.initialise(stringConfiguration);
        return creator.createImportText(groups);
    };

    const importCreatorTest = (testName, groups, expected) => {
        test(`ImportCreator : ${testName} produces correct string`, () => {
            const importText = getImportText(groups);
            expect(importText).to.eql(expected);
        });
    };

    testCases.forEach(testElement => {
        importCreatorTest(testElement.testName, testElement.elementGroups, testElement.expected);
    });
});<commit_msg>fixing tests<commit_after>import 'mocha';
import * as expect from 'expect.js';
import { ImportCreator, ImportElementGroup, ImportStringConfiguration } from '../src/core';

interface ImportCreatorTest {
    testName: string;
    elementGroups: ImportElementGroup[];
    expected: string;
}

suite('Import Creator Tests', () => {

    const stringConfiguration: ImportStringConfiguration = {
        tabSize: 4,
        numberOfEmptyLinesAfterAllImports: 2,
        quoteMark: 'single',
        maximumNumberOfImportExpressionsPerLine: {
            count: 23,
            type: 'maxLineLength'
        },
        spacingPerImportExpression: {
            afterStartingBracket: 1,
            beforeEndingBracket: 1,
            beforeComma: 0,
            afterComma: 1
        }
    };

    const testCases: ImportCreatorTest[] = [
        {
            testName: 'test0',
            elementGroups: [
                {
                    elements: [
                        {
                            moduleSpecifierName: 'createString.ts',
                            startPosition: { line: 0, character: 0 },
                            endPosition: { line: 0, character: 53 },
                            hasFromKeyWord: true,
                            defaultImportName: 't',
                            namedBindings: [
                                { name: 'B', aliasName: null },
                                { name: 'a', aliasName: 'cc' },
                                { name: 'ac', aliasName: null }
                            ]
                        }],
                    numberOfEmptyLinesAfterGroup: 3
                }
            ],
            expected: "import t, {\n    B, a as cc, ac\n} from \'createString.ts\';\n\n"
        }
    ];

    const getImportText = (groups: ImportElementGroup[]) => {
        const creator = new ImportCreator();
        creator.initialise(stringConfiguration);
        return creator.createImportText(groups);
    };

    const importCreatorTest = (testName, groups, expected) => {
        test(`ImportCreator : ${testName} produces correct string`, () => {
            const importText = getImportText(groups);
            expect(importText).to.eql(expected);
        });
    };

    testCases.forEach(testElement => {
        importCreatorTest(testElement.testName, testElement.elementGroups, testElement.expected);
    });
});
{'fraction_non_alphanumeric': 0.10190555095277548, 'fraction_numerical': 0.006420878210439105, 'mean_word_length': 1.5177267987486966, 'pattern_counts': {'":': 0, '<': 3, '<?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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5753013', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1178, 'n_words': 250}