forked from Seneca-CDOT/telescope
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Seneca-CDOT#83: Change test to async await
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
}); |