@mateola/cm-pgn
Version:
Module for parsing and rendering of PGNs (Portable Game Notation)
34 lines (32 loc) • 1.01 kB
JavaScript
/**
* Author and copyright: Stefan Haack (https://shaack.com)
* Repository: https://github.com/shaack/cm-pgn
* License: MIT, see file 'LICENSE'
*/
import {describe, it, assert} from "../node_modules/teevi/src/teevi.js"
import {Header, TAGS} from "../src/Header.js"
describe('Header', () => {
it('should parse header', () => {
const header = new Header(`[Event "F/S Return Match"]
[]
[]
[]
[]
[]
[]`)
assert.equal(Object.keys(header.tags).length, 7)
assert.equal(header.tags[TAGS.Event], "F/S Return Match")
})
it('should parse and render header', () => {
const content = `[Event "F/S Return Match"]
[]
[]
[]
[]
[]
[]
`
const header = new Header(content)
assert.equal(header.render(), content)
})
})