<commit_before>import { moduleName } from './date.module';
import { IDateUtility, IDateValue, serviceName } from './date.service';
import { defaultFormats } from './dateTimeFormatStrings';
import { timezones } from '../timezone/timezone.enum';
import { timezoneService } from '../timezone/timezone.service';

import { CompareResult } from '../../types/compareResult';

import { angularFixture } from '../test/angularFixture';

import * as angular from 'angular';
import 'angular-mocks';
import * as moment from 'moment';
import 'moment-timezone';


describe('dateUtility', () => {
	let dateUtility: IDateUtility;

	beforeEach(() => {
		angular.mock.module(moduleName);

		let services: any = angularFixture.inject(serviceName);
		dateUtility = services[serviceName];
	});

	describe('getFullString', (): void => {
		it('should get the month name', (): void => {
			expect(dateUtility.getFullString(0)).to.equal('January');
			expect(dateUtility.getFullString(1)).to.equal('February');
			expect(dateUtility.getFullString(2)).to.equal('March');
			expect(dateUtility.getFullString(3)).to.equal('April');
			expect(dateUtility.getFullString(4)).to.equal('May');
			expect(dateUtility.getFullString(5)).to.equal('June');
			expect(dateUtility.getFullString(6)).to.equal('July');
			expect(dateUtility.getFullString(7)).to.equal('August');
			expect(dateUtility.getFullString(8)).to.equal('September');
			expect(dateUtility.getFullString(9)).to.equal('October');
			expect(dateUtility.getFullString(10)).to.equal('November');
			expect(dateUtility.getFullString(11)).to.equal('December');
		});
	});

	describe('getDateFromServer', (): void => {
		it('should get dates from string in server format, "YYYY-MM-DDTHH:MM:SSZ"', (): void => {
			let expectedDate: moment.Moment = moment('2015-11-24T20:12:00-07:00', defaultFormats.isoFormat).tz(timezones.MST.momentName);
			let dateString: string = '2015-11-24T20:12:00-07:00';
			let date: moment.Moment = dateUtility.getDateFromISOString(dateString);
			expect(date.tz()).to.equal(expectedDate.tz());
			expect(date.format(defaultFormats.isoFormat)).to.equal(expectedDate.format(defaultFormats.isoFormat));
		});

		it('should return null if the server sends a null date', (): void => {
			expect(dateUtility.getDateFromISOString(null)).to.be.null;
		});
	});

	describe('isDate', (): void => {
		it('should be true if item is a date or a string, date, or moment format', (): void => {
			expect(dateUtility.isDate('1/1/2014')).to.be.true;
			expect(dateUtility.isDate(new Date('1/1/2014'))).to.be.true;<commit_msg>Should just assert not exists.<commit_after>import { moduleName } from './date.module';
import { IDateUtility, IDateValue, serviceName } from './date.service';
import { defaultFormats } from './dateTimeFormatStrings';
import { timezones } from '../timezone/timezone.enum';
import { timezoneService } from '../timezone/timezone.service';

import { CompareResult } from '../../types/compareResult';

import { angularFixture } from '../test/angularFixture';

import * as angular from 'angular';
import 'angular-mocks';
import * as moment from 'moment';
import 'moment-timezone';


describe('dateUtility', () => {
	let dateUtility: IDateUtility;

	beforeEach(() => {
		angular.mock.module(moduleName);

		let services: any = angularFixture.inject(serviceName);
		dateUtility = services[serviceName];
	});

	describe('getFullString', (): void => {
		it('should get the month name', (): void => {
			expect(dateUtility.getFullString(0)).to.equal('January');
			expect(dateUtility.getFullString(1)).to.equal('February');
			expect(dateUtility.getFullString(2)).to.equal('March');
			expect(dateUtility.getFullString(3)).to.equal('April');
			expect(dateUtility.getFullString(4)).to.equal('May');
			expect(dateUtility.getFullString(5)).to.equal('June');
			expect(dateUtility.getFullString(6)).to.equal('July');
			expect(dateUtility.getFullString(7)).to.equal('August');
			expect(dateUtility.getFullString(8)).to.equal('September');
			expect(dateUtility.getFullString(9)).to.equal('October');
			expect(dateUtility.getFullString(10)).to.equal('November');
			expect(dateUtility.getFullString(11)).to.equal('December');
		});
	});

	describe('getDateFromServer', (): void => {
		it('should get dates from string in server format, "YYYY-MM-DDTHH:MM:SSZ"', (): void => {
			let expectedDate: moment.Moment = moment('2015-11-24T20:12:00-07:00', defaultFormats.isoFormat).tz(timezones.MST.momentName);
			let dateString: string = '2015-11-24T20:12:00-07:00';
			let date: moment.Moment = dateUtility.getDateFromISOString(dateString);
			expect(date.tz()).to.equal(expectedDate.tz());
			expect(date.format(defaultFormats.isoFormat)).to.equal(expectedDate.format(defaultFormats.isoFormat));
		});

		it('should return null if the server sends a null date', (): void => {
			expect(dateUtility.getDateFromISOString(null)).to.not.exist;
		});
	});

	describe('isDate', (): void => {
		it('should be true if item is a date or a string, date, or moment format', (): void => {
			expect(dateUtility.isDate('1/1/2014')).to.be.true;
			expect(dateUtility.isDate(new Date('1/1/2014'))).to.be.true;
{'fraction_non_alphanumeric': 0.1799961081922553, 'fraction_numerical': 0.024129208017123954, 'mean_word_length': 5.4089775561097255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '2000330', 'n_tokens_mistral': 1827, 'n_tokens_neox': 1667, 'n_words': 275}