-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from justinwilaby/feature/unit-tests
Feature/unit tests
- Loading branch information
Showing
5 changed files
with
54 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,24 @@ | ||
import {SaxEventType, SAXParser} from '../index'; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
const saxWasm = fs.readFileSync(path.resolve(__dirname, '../../../lib/sax-wasm.wasm')); | ||
describe('When parsing JSX, the SaxWasm', () => { | ||
let parser: SAXParser; | ||
let _event: number; | ||
let _data: string; | ||
beforeEach(async () => { | ||
parser = new SAXParser(SaxEventType.ProcessingInstruction); | ||
parser.eventHandler = function (event: SaxEventType, data: string) { | ||
_event = event as number; | ||
_data = data; | ||
}; | ||
return parser.prepareWasm(saxWasm); | ||
}); | ||
|
||
it('should recognize Processing Instructions', () => { | ||
parser.write('<?xml version="1.0" encoding="utf-8"?>'); | ||
expect(_event).toBe(SaxEventType.ProcessingInstruction); | ||
expect(_data).toBe('version="1.0" encoding="utf-8"'); | ||
}); | ||
}); |
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