|
1 | 1 | import * as open from 'open'; |
2 | | -import { minify } from 'html-minifier'; |
| 2 | +import { minify } from 'html-minifier-terser'; |
3 | 3 | import { Plotting } from '../src/plotting'; |
4 | 4 | import { Backtest } from '../src/backtest'; |
5 | 5 | import { Stats } from '../src/stats'; |
6 | 6 | import { SmaCross } from './sma-cross.strategy'; |
7 | 7 |
|
8 | 8 | jest.mock('fs'); |
9 | 9 | jest.mock('open'); |
10 | | -jest.mock('html-minifier'); |
| 10 | +jest.mock('html-minifier-terser'); |
11 | 11 |
|
12 | 12 | describe('Plotting', () => { |
13 | 13 | let backtest: Backtest; |
@@ -47,18 +47,18 @@ describe('Plotting', () => { |
47 | 47 | }); |
48 | 48 |
|
49 | 49 | describe('.plot()', () => { |
50 | | - it('should create the HTML file with minified content', () => { |
51 | | - const options = { openBrowser: false, filename: 'test.html' }; |
| 50 | + it('should create the HTML file with minified content', async () => { |
| 51 | + const options = {openBrowser: false, filename: 'test.html'}; |
52 | 52 | const plotting = new Plotting(stats, options); |
53 | | - plotting.plot(); |
| 53 | + await plotting.plot(); |
54 | 54 | expect(minify).toHaveBeenCalled(); |
55 | 55 | expect(open).not.toBeCalled(); |
56 | 56 | }); |
57 | 57 |
|
58 | | - it('should create the HTML file with minified content and open it in the browser', () => { |
59 | | - const options = { openBrowser: true, filename: 'test.html' }; |
| 58 | + it('should create the HTML file with minified content and open it in the browser', async () => { |
| 59 | + const options = {openBrowser: true, filename: 'test.html'}; |
60 | 60 | const plotting = new Plotting(stats, options); |
61 | | - plotting.plot(); |
| 61 | + await plotting.plot(); |
62 | 62 | expect(minify).toHaveBeenCalled(); |
63 | 63 | expect(open).toHaveBeenCalledWith(`./${options.filename}`); |
64 | 64 | }); |
|
0 commit comments