<commit_before>import { getUidFromUserEmail } from './temp-auth-utils';
import { getCleanedTextInput, getCollaboratorUidArray }  from './filter-input.js';

describe('getCleanedTextInput tests', () => {
  test('No input entered in form (empty string)', () => {
    const testDefaultValue = 'Untitled Trip';
    const testRawName = '';
    const expectedTripName = testDefaultValue;

    const testTripName = getCleanedTextInput(testRawName, testDefaultValue);

    expect(testTripName).toEqual(expectedTripName);
  });

  test('Input entered into form', () => {
    const testDefaultValue = 'Untitled Trip';
    const testRawName = 'Trip to No Man\'s Land';
    const expectedTripName = testRawName;

    const testTripName = getCleanedTextInput(testRawName, testDefaultValue);

    expect(testTripName).toEqual(expectedTripName);
  });
});

const mockCurUserEmail = '<EMAIL>';
// TODO(Issue #55): Replace mock with real auth file once integrated.
jest.mock('./temp-auth-utils.js', () => ({
    getCurUserEmail: () => mockCurUserEmail,
    getUidFromUserEmail: (userEmail) => '_' + userEmail + '_',
}));
describe('getCollaboratorUidArray tests', () => {
  test('No collaborators entered', () => {
    const expectedUidArr = [getUidFromUserEmail(mockCurUserEmail)];
    // This is the list that is created when there are no collaborators added
    // (automatically one empty string from the constructor created ref).
    const testEmailArr = [''];

    const testUidArr = getCollaboratorUidArray(testEmailArr);

    expect(testUidArr).toEqual(expectedUidArr);
  });

  test('Some added collaborators', () => {
    const person1Email = '<EMAIL>';
    const person2Email = '<EMAIL>';
    const expectedUidArr = [getUidFromUserEmail(mockCurUserEmail),
        getUidFromUserEmail(person1Email), getUidFromUserEmail(person2Email)];
    const testEmailArr = [person1Email, person2Email];

    const testUidArr = getCollaboratorUidArray(testEmailArr);

    expect(testUidArr).toEqual(expectedUidArr);
  });

  test('Some added collaborators and some blank entries', () => {
    const person1Email = '<EMAIL>';
    const person2Email = '<EMAIL>';
    const expectedUidArr = [getUidFromUserEmail(mockCurUserEmail),
        getUidFromUserEmail(person1Email), getUidFromUserEmail(person2Email)];
    const testEmailArr = ['', person1Email, '', person2Email, ''];

    const testUidArr = getCollaboratorUidArray(testEmailArr);

    expect(testUidArr).toEqual(expectedUidArr);
  });
});<commit_msg>Fix import to correct function name so tests pass.<commit_after>import { getUserUidFromUserEmail } from './temp-auth-utils';
import { getCleanedTextInput, getCollaboratorUidArray }  from './filter-input.js';

describe('getCleanedTextInput tests', () => {
  test('No input entered in form (empty string)', () => {
    const testDefaultValue = 'Untitled Trip';
    const testRawName = '';
    const expectedTripName = testDefaultValue;

    const testTripName = getCleanedTextInput(testRawName, testDefaultValue);

    expect(testTripName).toEqual(expectedTripName);
  });

  test('Input entered into form', () => {
    const testDefaultValue = 'Untitled Trip';
    const testRawName = 'Trip to No Man\'s Land';
    const expectedTripName = testRawName;

    const testTripName = getCleanedTextInput(testRawName, testDefaultValue);

    expect(testTripName).toEqual(expectedTripName);
  });
});

const mockCurUserEmail = '<EMAIL>';
// TODO(Issue #55): Replace mock with real auth file once integrated.
jest.mock('./temp-auth-utils.js', () => ({
    getCurUserEmail: () => mockCurUserEmail,
    getUserUidFromUserEmail: (userEmail) => '_' + userEmail + '_',
}));
describe('getCollaboratorUidArray tests', () => {
  test('No collaborators entered', () => {
    const expectedUidArr = [getUserUidFromUserEmail(mockCurUserEmail)];
    // This is the list that is created when there are no collaborators added
    // (automatically one empty string from the constructor created ref).
    const testEmailArr = [''];

    const testUidArr = getCollaboratorUidArray(testEmailArr);

    expect(testUidArr).toEqual(expectedUidArr);
  });

  test('Some added collaborators', () => {
    const person1Email = '<EMAIL>';
    const person2Email = '<EMAIL>';
    const expectedUidArr = [getUserUidFromUserEmail(mockCurUserEmail),
        getUserUidFromUserEmail(person1Email), getUserUidFromUserEmail(person2Email)];
    const testEmailArr = [person1Email, person2Email];

    const testUidArr = getCollaboratorUidArray(testEmailArr);

    expect(testUidArr).toEqual(expectedUidArr);
  });

  test('Some added collaborators and some blank entries', () => {
    const person1Email = '<EMAIL>';
    const person2Email = '<EMAIL>';
    const expectedUidArr = [getUserUidFromUserEmail(mockCurUserEmail),
        getUserUidFromUserEmail(person1Email), getUserUidFromUserEmail(person2Email)];
    const testEmailArr = ['', person1Email, '', person2Email, ''];

    const testUidArr = getCollaboratorUidArray(testEmailArr);

    expect(testUidArr).toEqual(expectedUidArr);
  });
});
{'fraction_non_alphanumeric': 0.12671029149315882, 'fraction_numerical': 0.005552250644457664, 'mean_word_length': 4.797701149425287, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 33, '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': '409225', 'n_tokens_mistral': 1550, 'n_tokens_neox': 1505, 'n_words': 324}