import { assert , expect } from 'chai' ; import 'mocha' ; import * as dataForge from 'data-forge' ; import 'data-forge-fs' ; import "../../index" ; import * as path from 'path' ; import { readJSON , writeJSON } from './test-utils' ; describe ( 'macd' , ( ) => { it ( 'macd' , async function ( ) { let df = await dataForge . readFile ( "./src/test/data/STW.csv" ) . parseCSV ( { dynamicTyping : true } ) ; df = df . setIndex ( "date" ) ; const macd = df . deflate ( row => row . close ) . macd ( 12 , 26 , 9 ) ; const values = macd . toPairs ( ) ; const outputFilePath = path . join ( __dirname , "output" , this . test . fullTitle ( ) + ".json" ) ; const expectedOutput = await readJSON ( outputFilePath ) ; expect ( values ) . to . eql ( expectedOutput ) ; } ) ; } ) ;