-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor throwing exceptions. Added writeGltfSpec
- Loading branch information
JoshuaStorm
committed
Jun 29, 2016
1 parent
24f1e79
commit eacb0de
Showing
5 changed files
with
78 additions
and
22 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
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
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,41 @@ | ||
'use strict'; | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var writeGltf = require('../../lib/writeGltf'); | ||
var readGltf = require('../../lib/readGltf'); | ||
|
||
var gltfPath = './specs/data/boxTexturedUnoptimized/CesiumTexturedBoxTest_BinaryInput.gltf'; | ||
var outputGltfPath = './output/CesiumTexturedBoxTest.gltf'; | ||
var invalidPath = './specs/data/boxTexturedUnoptimized/CesiumTexturedBoxTest.exe'; | ||
|
||
describe('writeGltf', function() { | ||
it('will write a file to the correct directory', function(done) { | ||
var spy = spyOn(fs, 'writeFile').and.callFake(function(file, data, callback) { | ||
callback(); | ||
}); | ||
|
||
writeGltf(gltfPath, outputGltfPath, true, true, false, function() { | ||
expect(path.normalize(spy.calls.first().args[0])).toEqual(path.normalize(outputGltfPath)); | ||
}); | ||
done(); | ||
}); | ||
|
||
it('throws an invalid output path error', function() { | ||
var options = {}; | ||
readGltf(gltfPath, options, function(gltf) { | ||
expect(function() { | ||
writeGltf(gltf, undefined, true, true, true); | ||
}).toThrowError('Output path is undefined.'); | ||
}); | ||
}); | ||
|
||
it('throws an invalid output extension error', function() { | ||
var options = {}; | ||
readGltf(gltfPath, options, function(gltf) { | ||
expect(function() { | ||
writeGltf(gltf, invalidPath, true, true, true); | ||
}).toThrowError('Invalid output path extension.'); | ||
}); | ||
}); | ||
|
||
}); |