mirror of
https://github.com/scratchfoundation/scratch-parser.git
synced 2025-08-28 22:18:45 -04:00
test(tests): fix up tests to accommodate new apis
This commit is contained in:
parent
b808e7447f
commit
b0d1e46cd8
10 changed files with 154 additions and 64 deletions
8
index.js
8
index.js
|
@ -7,20 +7,22 @@ var validate = require('./lib/validate');
|
|||
/**
|
||||
* Unpacks, parses, validates, and analyzes Scratch projects. If successful,
|
||||
* will return a valid Scratch project object with appended metadata.
|
||||
* @param {boolean} isSprite Whether this is a sprite (true) or whole project (false)
|
||||
* @param {Buffer | string} input Buffer or string representing project
|
||||
* @param {boolean} isSprite Whether this is a sprite (true) or whole project (false)
|
||||
* @param {Function} callback Returns error or project data
|
||||
*/
|
||||
module.exports = function (isSprite, input, callback) {
|
||||
module.exports = function (input, isSprite, callback) {
|
||||
// First unpack the input (need this outside of the async waterfall so that
|
||||
// unpackedProject can be refered to again)
|
||||
unpack(isSprite, input, function (err, unpackedProject) {
|
||||
unpack(input, isSprite, function (err, unpackedProject) {
|
||||
if (err) return callback(err);
|
||||
|
||||
async.waterfall([
|
||||
function (cb) {
|
||||
parse(unpackedProject[0], cb);
|
||||
},
|
||||
// TODO is there a better way to pass this arg
|
||||
// than partially applying this funciton?
|
||||
validate.bind(null, isSprite)
|
||||
], function (error, validatedInput) {
|
||||
// One more callback wrapper so that we can re-package everything
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue