-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79db7bf
commit 3b2c7dc
Showing
10 changed files
with
5,725 additions
and
80 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,28 @@ | ||
import Manifest from '../src/Manifest'; | ||
describe('Manifest', () => { | ||
let subject; | ||
beforeEach(() => { | ||
subject = new Manifest(); | ||
}); | ||
describe('.merge(zip, counter)', () => { | ||
it.todo('merges the given zip file manifest into doc'); | ||
}); | ||
|
||
describe('.toXml(formatted)', () => { | ||
it('returns XML ', () => { | ||
jest.spyOn(subject, 'doc', 'get').mockReturnValue({ hello: 'world' }); | ||
expect(subject.toXml()).toMatchInlineSnapshot(` | ||
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" ?> | ||
<hello>world</hello> | ||
" | ||
`); | ||
expect(subject.toXml(false)).toMatchInlineSnapshot(` | ||
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" ?> | ||
<hello>world</hello>" | ||
`); | ||
|
||
jest.spyOn(subject, 'doc', 'get').mockReturnValue(''); | ||
expect(subject.toXml()).toMatchInlineSnapshot(`""`); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,25 +1,46 @@ | ||
import XMLFileBase from '../src/XMLFileBase'; | ||
import fixture from './__fixtures__/content.json'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
describe('XMLFileBase', () => { | ||
describe('.namespaces', () => { | ||
it.todo('extracts namespace key/pairs for the XML document'); | ||
let subject; | ||
beforeEach(() => { | ||
subject = new XMLFileBase(); | ||
}); | ||
|
||
describe('.data', () => { | ||
it.todo('converts the XML to object notation'); | ||
describe('.namespaces', () => { | ||
it('extracts namespace key/pairs for the XML document', () => { | ||
subject.rootKey = 'office:document-content'; | ||
jest.spyOn(subject, 'data', 'get').mockReturnValue(fixture); | ||
expect(subject.namespaces).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
describe('.contentOriginal', () => { | ||
it.todo('extracts the selected content keys from the data'); | ||
describe('.data', () => { | ||
it('converts the XML to object notation', () => { | ||
subject.xml = fs | ||
.readFileSync(path.join(__dirname, '__fixtures__/content.xml')) | ||
.toString(); | ||
let actual = subject.data; | ||
expect(actual).toEqual(fixture); | ||
}); | ||
}); | ||
|
||
describe('.content', () => { | ||
it.todo('returns optimised content with pre-processors'); | ||
}); | ||
|
||
describe('.changeImagePaths', () => { | ||
it.todo('replaces references of asset path with its updated location'); | ||
it('returns optimised content with pre-processors', () => { | ||
jest.spyOn(subject, 'data', 'get').mockReturnValue(fixture); | ||
expect(subject.content).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
describe('.changeKeyReferences', () => { | ||
it.todo('replaces references of styles with the updated reference'); | ||
it('replaces references of styles with the updated reference', () => { | ||
let given = { 'hello:world': 'prefixme' }; | ||
jest.spyOn(subject, 'prefixKeys', 'get').mockReturnValue(['hello:world']); | ||
subject.id = 0; | ||
let actual = subject.changeKeyReferences(given); | ||
expect(actual).toEqual({ 'hello:world': '0-prefixme' }); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.