<commit_before>'use strict'

const test = require('ava')

const { subDays } = require('date-fns')

const ranges = require('../../src/constants/ranges')
const zeroDate = require('../../src/utils/zeroDate')
const offsetByRange = require('../../src/utils/offsetByRange')

test('return correct offset for RANGES_LAST_24_HOURS', async (t) => {

	const result = offsetByRange(ranges.RANGES_LAST_24_HOURS)

	t.deepEqual(result, subDays(zeroDate(), 1))

})

test('return correct offset for RANGES_LAST_7_DAYS', async (t) => {

	const result = offsetByRange(ranges.RANGES_LAST_7_DAYS)

	t.deepEqual(result, subDays(zeroDate(), 6))

})

test('return correct offset for RANGES_LAST_30_DAYS', async (t) => {

	const result = offsetByRange(ranges.RANGES_LAST_30_DAYS)

	t.deepEqual(result, subDays(zeroDate(), 29))
<commit_msg>Fix test<commit_after>'use strict'

const test = require('ava')

const { startOfDay, subDays } = require('date-fns')

const ranges = require('../../src/constants/ranges')
const offsetByRange = require('../../src/utils/offsetByRange')

test('return correct offset for RANGES_LAST_24_HOURS', async (t) => {

	const result = offsetByRange(ranges.RANGES_LAST_24_HOURS)

	t.deepEqual(result, subDays(startOfDay(new Date()), 1))

})

test('return correct offset for RANGES_LAST_7_DAYS', async (t) => {

	const result = offsetByRange(ranges.RANGES_LAST_7_DAYS)

	t.deepEqual(result, subDays(startOfDay(new Date()), 6))

})

test('return correct offset for RANGES_LAST_30_DAYS', async (t) => {

	const result = offsetByRange(ranges.RANGES_LAST_30_DAYS)

	t.deepEqual(result, subDays(startOfDay(new Date()), 29))

{'fraction_non_alphanumeric': 0.15327564894932014, 'fraction_numerical': 0.0173053152039555, 'mean_word_length': 5.635245901639344, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3800778', 'n_tokens_mistral': 611, 'n_tokens_neox': 572, 'n_words': 114}