1
0
Fork 0
mirror of https://github.com/Oreolek/gamebookformat.git synced 2024-06-16 15:10:45 +03:00

Stubs for testing html template javascript using node.js.

This commit is contained in:
Pelle Nilsson 2013-06-16 09:41:32 +02:00
parent d431d1f47e
commit 0bad58abe3
6 changed files with 55 additions and 3 deletions

3
.gitignore vendored
View file

@ -14,4 +14,5 @@ test.html
target
*.map
.uploadto
readme.html
readme.html
node_modules

View file

@ -38,7 +38,7 @@ readme.html: readme.org
%.png: %.dot
dot -Tpng $< > $@
test: unittest checkexpected
test: unittest checkexpected templatejstest
expected: all
$(RM) expected/* && cp examples/*.{rtf,tex,html,debug,txt,dot,map} \
@ -55,9 +55,17 @@ unittest: *.py
upload: html png pdf rtf
if [ -n "$(uploadto)" ]; then \
scp examples/*.html examples/*.png examples/*.pdf examples/*.rtf $(uploadto);\
scp examples/*.html examples/*.png examples/*.pdf examples/*.rtf \
$(uploadto);\
fi
test/templatejs/htmlscripts.js: $(wildcard templates/html/*script.html)
./templates.py html script > $@
templatejstest: test/templatejs/htmlscripts.js \
test/templatejs/testhtmlscripts.js
node test/templatejs/testhtmlscripts.js
clean:
$(RM) examples/*rtf examples/*.html examples/*.tex \
examples/*.txt examples/*.debug examples/*.log \

View file

@ -43,6 +43,25 @@ configuration (eg /C-c C-q/ to edit section tags).
References to sections can be followed using
/C-c C-o/ while editing the book in org-mode.
** Dependencies
*** Required
- Python 2.7 :: To run formatgamebook.py.
*** Optional
To make something useful from some of the outputted files.
- pdflatex :: Make pdf from tex files.
- Graphviz :: Includes the dot command that can make images from dot files.
*** Development
The following are only needed for working on improving
the scripts (and even then you can proabbly do without all or most).
- GNU make :: Runs tests and various other useful development tasks.
(This in turn depends on some tools like diff, but if you
have make installed you probably have them as well.)
- node.js :: To run some tests of HTML (JavaScript) templates.
- nodeunit :: Unit test framework for node.js.
** License
Copyright (c) 2013 Pelle Nilsson

View file

@ -3,3 +3,9 @@
#include "extra-gamebookscript"
};
// little hack to make easy to test from node.js
if (typeof exports !== 'undefined') {
exports.gamebook = gamebook;
}

1
test/templatejs/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
htmlscripts.js

View file

@ -0,0 +1,17 @@
#!/usr/bin/env node
exports.setUp = function(cb) {
this.hs = hs = require('./htmlscripts.js');
cb();
};
exports.test1 = function(test) {
test.deepEqual(this.hs.gamebook.player.collections, {});
test.done();
};
var reporter = require('nodeunit').reporters['default'];
process.chdir(__dirname);
reporter.run(['./testhtmlscripts.js']);