<commit_before>AWS = require('../../lib/core')

describe 'AWS.util.date', ->
  util = AWS.util.date

  describe 'getDate', ->
    it 'should return current date by default', ->
      oldDate = Date; now = {}
      `Date = jasmine.createSpy().andReturn(now);`
      expect(util.getDate()).toBe(now)
      `Date = oldDate;`

  describe 'getISODateString', ->
    it 'should return date formatted as YYYYMMDDTHHnnssZ', ->
      spyOn(util, 'getDate').andCallFake -> new Date(600000)
      expect(util.getISODateString()).toEqual('19700101T001000Z')

    it 'should allow date parameter', ->
      expect(util.getISODateString(new Date(600000))).toEqual('19700101T001000Z')

describe 'AWS.util.crypto', ->
  util = AWS.util.crypto

  describe 'toHex', ->
    it 'should convert binary data to hex string', ->
      expect(util.toHex('ABC')).toEqual('414243')

  describe 'hmac', -><commit_msg>Add tests for getUTCDateString<commit_after>AWS = require('../../lib/core')

describe 'AWS.util.date', ->
  util = AWS.util.date

  describe 'getDate', ->
    it 'should return current date by default', ->
      oldDate = Date; now = {}
      `Date = jasmine.createSpy().andReturn(now);`
      expect(util.getDate()).toBe(now)
      `Date = oldDate;`

  describe 'getISODateString', ->
    it 'should return date formatted as YYYYMMDDTHHnnssZ', ->
      spyOn(util, 'getDate').andCallFake -> new Date(600000)
      expect(util.getISODateString()).toEqual('19700101T001000Z')

    it 'should allow date parameter', ->
      expect(util.getISODateString(new Date(660000))).toEqual('19700101T001100Z')

  describe 'getUTCDateString', ->
    it 'should return date formatted as YYYYMMDDTHHnnssZ', ->
      spyOn(util, 'getDate').andCallFake -> new Date(600000)
      expect(util.getUTCDateString()).toEqual('Thu, 01 Jan 1970 00:10:00 GMT')

    it 'should allow date parameter', ->
      expect(util.getUTCDateString(new Date(660000))).toEqual('Thu, 01 Jan 1970 00:11:00 GMT')


describe 'AWS.util.crypto', ->
  util = AWS.util.crypto

  describe 'toHex', ->
    it 'should convert binary data to hex string', ->
      expect(util.toHex('ABC')).toEqual('414243')

  describe 'hmac', ->
{'fraction_non_alphanumeric': 0.15898617511520738, 'fraction_numerical': 0.05898617511520737, 'mean_word_length': 3.551362683438155, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '2821489', 'n_tokens_mistral': 823, 'n_tokens_neox': 717, 'n_words': 156}