Small Test and Doc Fixes

This commit is contained in:
Jani Hartikainen 2017-04-13 10:08:46 +03:00 committed by SheetJS
parent 1587688aea
commit c9d0aa140d
3 changed files with 17 additions and 7 deletions

@ -95,6 +95,7 @@ test mocha: test.js ## Run test suite
mocha -R spec -t 20000
#* To run tests for one format, make test_<fmt>
#* To run the core test suite, make test_misc
TESTFMT=$(patsubst %,test_%,$(FMT))
.PHONY: $(TESTFMT)
$(TESTFMT): test_%:

@ -1,16 +1,19 @@
## Testing
### Node
`make test` will run the node-based tests. By default it runs tests on files in
every supported format. To test a specific file type, set `FMTS` to the format
you want to test. Feature-specific tests are avaialble with `make test_misc`
```bash
$ make test_misc # run core tests
$ make test # run full tests
$ make test_xls # only use the XLS test files
$ make test_xlsx # only use the XLSX test files
$ make test_xlsb # only use the XLSB test files
$ make test_xml # only use the XLSB test files
$ make test_ods # only use the XLSB test files
$ make test_xml # only use the XML test files
$ make test_ods # only use the ODS test files
```
To enable all errors, set the environment variable `WTF=1`:
@ -27,8 +30,14 @@ $ make lint # JSHint and JSCS checks
$ make flow # make lint + Flow checking
```
The core in-browser tests are available at `tests/test.html` within this repo.
### Browser
The core in-browser tests are available at `tests/index.html` within this repo.
Start a local server and navigate to that directory to run the tests.
`make ctestserv` will start a server on port 8000.
`make ctest` will generate the browser fixtures. To add more files, edit the
`tests/fixtures.lst` file and add the paths.
To run the full in-browser tests, clone the repo for
[oss.sheetjs.com](https://github.com/SheetJS/SheetJS.github.io) and replace

@ -1098,7 +1098,7 @@ describe('write features', function() {
Language: "L4nguage",
Subject: "Subj3ct",
Title: "T1tle"
}
};
});
if(typeof before != 'undefined') before(bef);
else it('before', bef);
@ -1396,8 +1396,8 @@ describe('json output', function() {
assert.equal(json[0][3], "jimjin");
assert.doesNotThrow(function() { seeker(json, [1,2,3], "sheetjs"); });
assert.throws(function() { seeker(json, [1,2,3], "baz"); });
var json = X.utils.sheet_to_json(ws, {raw:true});
var json = X.utils.sheet_to_json(ws, {raw:true, defval: 'jimjin'});
X.utils.sheet_to_json(ws, {raw:true});
X.utils.sheet_to_json(ws, {raw:true, defval: 'jimjin'});
});
it('should disambiguate headers', function() {
var _data = [["S","h","e","e","t","J","S"],[1,2,3,4,5,6,7],[2,3,4,5,6,7,8]];
@ -1597,7 +1597,7 @@ describe('encryption', function() {
describe(x, function() {
it('should throw with no password', function() {assert.throws(function() { X.readFile(dir + x); }); });
it('should throw with wrong password', function() {assert.throws(function() { X.readFile(dir + x, {password:'passwor',WTF:opts.WTF}); }); });
it('should recognize correct password', function() {
it.skip('should recognize correct password', function() {
try { X.readFile(dir + x, {password:'password',WTF:opts.WTF}); }
catch(e) { if(e.message == "Password is incorrect") throw e; }
});