Skip to content

Commit

Permalink
Fix Seneca-CDOT#83: Change test to async await
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuong Tran authored and Tuong Tran committed Nov 10, 2019
1 parent 03f90c9 commit a1de9b4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/text-parser.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const textParser = require('../src/text-parser');


/**
* textParser.run() will convert the html to text plain
* Function should only extract what in the body
*/
test('Testing text-parser', async () => {
const result = await textParser.run('<!DOCTYPE html><p>Hello World</p>');
expect(result).toBe('Hello World');
})

test('Testing text-parser with new line', async () => {
const result = await textParser.run('<!DOCTYPE html><html><head><title>OSD600</title></head><body style = "text-align:center;"><h1>Seneca</h1><div style="white-space: pre">OpenSource Telescope</div></body></html>');
expect(result).toBe('Seneca\nOpenSource Telescope')
});

0 comments on commit a1de9b4

Please sign in to comment.