<commit_before>var assert = require('assert');
var expect = require('chai').expect;

var parse = require('./../utils/parseTaskTemplate.js')

describe('parseTaskTemplate.js', function () {
  
  describe('templateToNoteString()', function () {
    it('should return empty str with empty template', function () {
      expect(parse.templateToNoteString({})).to.equal("");
    });

    it('should properly parse starred', function (){
      var template = {starred: true};
      expect(parse.templateToNoteString(template)).to.equal("starred\n")
    });

    it('should properly parse list', function (){
      var template = {list: 'test'};
      expect(parse.templateToNoteString(template)).to.equal("list: test\n")
    });

    it('should properly parse note', function (){
      var template = {note: 'hello world'};
      expect(parse.templateToNoteString(template)).to.equal("note: hello world\n")
    });
    it('should properly parse due_date, repeat_every, and start_time', function (){
      var testDate = Date.parse("1/1/2020")
      var template = {due_date: testDate, start_time: testDate, due_date: testDate};
      var correct = "due-date: 2020/01/01\nstart-time: 00:00:00\n"
      expect(parse.templateToNoteString(template)).to.equal(correct)
    });
  });

  describe('updateTemplateWithRepeat()', function () {
    it('should return null if no repeat could be parsed', function() {
        var template = {repeat_every:"this is not a valid date"};
        expect(parse.updateTemplateWithRepeat(template)).to.equal(null);
    });
    it('should find the earliest next repetition', function() {
        var template = {repeat_every:"tomorrow, today"};
        var today = new Date.parse('today')
        expect(parse.updateTemplateWithRepeat(template).due_date.toString()).to.equal(today.toString());

        template = {repeat_every:"+20 days, +3 days"};
        today = new Date.parse('+3 days')
        expect(parse.updateTemplateWithRepeat(template).due_date.toString()).to.equal(today.toString());

        template = {repeat_every:"+5 months, +3 years"};
        today = new Date.parse('+5 months')
        expect(parse.updateTemplateWithRepeat(template).due_date.toString()).to.equal(today.toString());

        template = {repeat_every:"monday"};
        today = new Date.parse('next monday')
        expect(parse.updateTemplateWithRepeat(template).due_date.toString()).to.equal(today.toString());
    });<commit_msg>Fixed test to reflect new date formatter<commit_after>var assert = require('assert');
var expect = require('chai').expect;

var parse = require('./../utils/parseTaskTemplate.js')

describe('parseTaskTemplate.js', function () {
  
  describe('templateToNoteString()', function () {
    it('should return empty str with empty template', function () {
      expect(parse.templateToNoteString({})).to.equal("");
    });

    it('should properly parse starred', function (){
      var template = {starred: true};
      expect(parse.templateToNoteString(template)).to.equal("starred\n")
    });

    it('should properly parse list', function (){
      var template = {list: 'test'};
      expect(parse.templateToNoteString(template)).to.equal("list: test\n")
    });

    it('should properly parse note', function (){
      var template = {note: 'hello world'};
      expect(parse.templateToNoteString(template)).to.equal("note: hello world\n")
    });
    it('should properly parse due_date, repeat_every, and start_time', function (){
      var testDate = Date.parse("1/1/2020")
      var template = {due_date: testDate, start_time: testDate, due_date: testDate};
      var correct = "due-date: 2020/01/01\nstart-time: 12:00 AM\n"
      expect(parse.templateToNoteString(template)).to.equal(correct)
    });
  });

  describe('updateTemplateWithRepeat()', function () {
    it('should return null if no repeat could be parsed', function() {
        var template = {repeat_every:"this is not a valid date"};
        expect(parse.updateTemplateWithRepeat(template)).to.equal(null);
    });
    it('should find the earliest next repetition', function() {
        var template = {repeat_every:"tomorrow, today"};
        var today = new Date.parse('today')
        expect(parse.updateTemplateWithRepeat(template).due_date.toString()).to.equal(today.toString());

        template = {repeat_every:"+20 days, +3 days"};
        today = new Date.parse('+3 days')
        expect(parse.updateTemplateWithRepeat(template).due_date.toString()).to.equal(today.toString());

        template = {repeat_every:"+5 months, +3 years"};
        today = new Date.parse('+5 months')
        expect(parse.updateTemplateWithRepeat(template).due_date.toString()).to.equal(today.toString());

        template = {repeat_every:"monday"};
        today = new Date.parse('next monday')
        expect(parse.updateTemplateWithRepeat(template).due_date.toString()).to.equal(today.toString());
    });
{'fraction_non_alphanumeric': 0.1567148970857958, 'fraction_numerical': 0.010597106174852253, 'mean_word_length': 3.8402366863905324, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3805940', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1382, 'n_words': 297}