<commit_before>/**
 * Created by Janne on 9.11.2014.
 */

var should = require('should');
var StockManager = require('./../js/stock-manager');
var winston = require('winston');

describe("Testing stock-manager.js for its functions", function() {

    describe("Checking for working snapshots", function () {
        it("Should get a snapshot of the defined stock", function(done) {

            var stockManager = new StockManager();

            // Define the JSON
            var json = {
                symbol: 'AAPL',
                fields: ['s', 'n', 'd1', 'l1', 'y', 'r']
            };

            stockManager.GetSnapshot(json, function(err, result) {

                if(err) {
                    throw err;
                }


                // Things should be okay
                result.name.should.equal('Apple Inc.');
                result.should.not.be.empty;

                // Things ok!
                done();
            });
        });

    });

});<commit_msg>Added some tests for historical info<commit_after>/**
 * Created by Janne on 9.11.2014.
 */

var should = require('should');
var StockManager = require('./../js/stock-manager');
var winston = require('winston');

describe("Testing stock-manager.js for its functions", function() {

    describe("Checking for working snapshots", function () {
        it("Should get a snapshot of the defined stock", function(done) {

            var stockManager = new StockManager();

            // Define the JSON
            var json = {
                symbol: 'AAPL',
                fields: ['s', 'n', 'd1', 'l1', 'y', 'r']
            };

            stockManager.GetSnapshot(json, function(err, result) {

                if(err) {
                    throw err;
                }


                // Things should be okay
                result.name.should.equal('Apple Inc.');
                result.should.not.be.empty;

                // Things ok!
                done();
            });
        });

    });

    describe("Checking for the historical data", function() {
        it("Should get historical data of apple stock", function(done) {

            var stockManager = new StockManager();

            var json = {
                symbol: 'AAPL',
                from: '2012-01-01',
                to: '2012-12-31',
                period : 'd'
                // period: 'd'  // 'd' (daily), 'w' (weekly), 'm' (monthly), 'v' (dividends only)
            };

            stockManager.GetHistorical(json, function(err, result) {
                if(err) {
                    throw err;
                }

                // Things should be okay
                result.should.not.be.empty;
                result[0].open.should.be.number;
                result[0].high.should.be.number;
                result[0].low.should.be.number;
                result[0].close.should.be.number;

                // Works!
                done();
            });
        });
    });

});
{'fraction_non_alphanumeric': 0.13747899159663865, 'fraction_numerical': 0.012773109243697478, 'mean_word_length': 1.3788968824940049, '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': '5600098', 'n_tokens_mistral': 847, 'n_tokens_neox': 760, 'n_words': 199}