<commit_before>techanModule('indicator/ema', function(specBuilder) {
  'use strict';

  var techan = require('../../../../src/techan'),
    data = require('./../_fixtures/data/movingaverage');

  var actualInit = function() {
    return techan.indicator.ema;
  };

  specBuilder.require(require('../../../../src/indicator/ema'), function(instanceBuilder) {
    instanceBuilder.instance('actual', actualInit, function(scope) {
      describe('And ema is initialised with defaults', function () {
        var ema;

        beforeEach(function () {
          ema = scope.ema;
        });

        it('Then on default invoke, ema should calculate correct values', function() {
          ema(data.input).forEach(function(d, i) {
            expect(d).toEqual(data.expected.ema[i]);
          });
        });
      });<commit_msg>Added another ema test case to ensure same results are returned on multiple calculation and that nothing is cached<commit_after>techanModule('indicator/ema', function(specBuilder) {
  'use strict';

  var techan = require('../../../../src/techan'),
    data = require('./../_fixtures/data/movingaverage');

  var actualInit = function() {
    return techan.indicator.ema;
  };

  specBuilder.require(require('../../../../src/indicator/ema'), function(instanceBuilder) {
    instanceBuilder.instance('actual', actualInit, function(scope) {
      describe('And ema is initialised with defaults', function () {
        var ema;

        beforeEach(function () {
          ema = scope.ema;
        });

        describe('And on default invoke', function() {
          var result;

          beforeEach(function() {
            result = ema(data.input);
          });

          it('Then ema should calculate correct values', function() {
            result.forEach(function(d, i) {
              expect(d).toEqual(data.expected.ema[i]);
            });
          });

          describe('And on second default invoke', function() {
            beforeEach(function() {
              result = ema(data.input);
            });

            it('Then ema should calculate the same correct values', function() {
              result.forEach(function(d, i) {
                expect(d).toEqual(data.expected.ema[i]);
              });
            });
          });
        });
      });
{'fraction_non_alphanumeric': 0.15404699738903394, 'fraction_numerical': 0.0, 'mean_word_length': 2.1930555555555555, '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': '3208625', 'n_tokens_mistral': 618, 'n_tokens_neox': 598, 'n_words': 134}