<commit_before>'use strict';

import { assert } from './test_utils';
import * as helpers from '../helpers';

describe('nextDate', () => {
        it ("should work", () => {
            assert.equal(helpers.nextDate("XXXX-07-01", new Date('2017-06-30T23:59:59.000Z')).toISOString(), '2017-07-01T00:00:00.000Z');
            assert.equal(helpers.nextDate("XXXX-07-01", new Date('2017-07-01T00:00:00.000Z')).toISOString(), '2017-07-01T00:00:00.000Z');
            assert.equal(helpers.nextDate("XXXX-07-01", new Date('2017-07-01T00:00:01.000Z')).toISOString(), '2018-07-01T00:00:00.000Z');
        });
        it ("should chain", () => {
            assert.equal(helpers.nextDate("XXXX-10-31", helpers.nextDate("XXXX-07-01", new Date('2017-06-30T23:59:59.000Z'))).toISOString(), '2017-10-31T00:00:00.000Z');
            assert.equal(helpers.nextDate("XXXX-10-31", helpers.nextDate("XXXX-07-01", new Date('2017-07-01T00:00:00.000Z'))).toISOString(), '2017-10-31T00:00:00.000Z');
            assert.equal(helpers.nextDate("XXXX-10-31", helpers.nextDate("XXXX-07-01", new Date('2017-07-01T00:00:01.000Z'))).toISOString(), '2018-10-31T00:00:00.000Z');
        });
});

describe('addDays', () => {
    it("should work", () => {
        const d = new Date("2017-01-31");
        const d2 = helpers.addDays(d, 1);
        assert.equal(d.toISOString(), '2017-01-31T00:00:00.000Z');
        assert.equal(d2.toISOString(), '2017-02-01T00:00:00.000Z');
    })
});<commit_msg>add a test on helpers.addDays<commit_after>'use strict';

import { assert } from './test_utils';
import * as helpers from '../helpers';

describe('nextDate', () => {
        it ("should work", () => {
            assert.equal(helpers.nextDate("XXXX-07-01", new Date('2017-06-30T23:59:59.000Z')).toISOString(), '2017-07-01T00:00:00.000Z');
            assert.equal(helpers.nextDate("XXXX-07-01", new Date('2017-07-01T00:00:00.000Z')).toISOString(), '2017-07-01T00:00:00.000Z');
            assert.equal(helpers.nextDate("XXXX-07-01", new Date('2017-07-01T00:00:01.000Z')).toISOString(), '2018-07-01T00:00:00.000Z');
        });
        it ("should chain", () => {
            assert.equal(helpers.nextDate("XXXX-10-31", helpers.nextDate("XXXX-07-01", new Date('2017-06-30T23:59:59.000Z'))).toISOString(), '2017-10-31T00:00:00.000Z');
            assert.equal(helpers.nextDate("XXXX-10-31", helpers.nextDate("XXXX-07-01", new Date('2017-07-01T00:00:00.000Z'))).toISOString(), '2017-10-31T00:00:00.000Z');
            assert.equal(helpers.nextDate("XXXX-10-31", helpers.nextDate("XXXX-07-01", new Date('2017-07-01T00:00:01.000Z'))).toISOString(), '2018-10-31T00:00:00.000Z');
        });
});

describe('addDays', () => {
    it("should work", () => {
        const d = new Date("2017-01-31");
        const d2 = helpers.addDays(d, 1);
        assert.equal(d.toISOString(), '2017-01-31T00:00:00.000Z');
        assert.equal(d2.toISOString(), '2017-02-01T00:00:00.000Z');
    })
    it("should work with float", () => {
        const d = new Date("2017-01-31T23:00:00.000Z");
        const d2 = helpers.addDays(d, 0.9999);
        assert.equal(d2.toISOString().replace(/T.*/, ''), '2017-02-01');
    })
});
{'fraction_non_alphanumeric': 0.23086654016445288, 'fraction_numerical': 0.19038583175205567, 'mean_word_length': 3.3930555555555557, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '5081961', 'n_tokens_mistral': 1554, 'n_tokens_neox': 1215, 'n_words': 138}