UNPKG

pbxproj

Version:

parse & stringify xcode pbxproj format

59 lines (45 loc) 1.55 kB
var _ = require('lodash'); var assert = require('assert'); var ObjectStage = require('../lib/stage/object'); describe('ObjectStage', function () { it('should call expectedError when first caracter is not "{"', function (done) { var ctx = {}; var stage = new ObjectStage(ctx, '[', 0, 0); stage.expectedError = _.partial(done, null); stage.run(); }); it('should call open when first caracter is "{"', function (done) { var ctx = {}; var stage = new ObjectStage(ctx, '{', 0, 0); stage.expectedError = _.noop; stage.open = _.partial(done, null); stage.run(); }); it('should call beginClose when "{" is found', function (done) { var ctx = {}; var stage = new ObjectStage(ctx, '{}', 0, 0); stage.expectedError = _.noop; stage.beginClose = _.partial(done, null); stage.run(); }); it('should call expectedError when "{" is found but no ";"', function (done) { var ctx = {}; var stage = new ObjectStage(ctx, '{}', 0, 0); stage.expectedError = _.partial(done, null); stage.run(); }); it('should call endClose when object is correctly closed', function (done) { var ctx = {}; var stage = new ObjectStage(ctx, '{};', 0, 0); stage.endClose = _.partial(done, null); stage.run(); }); it('should feed the ctx object', function (done) { var ctx = {}; var stage = new ObjectStage(ctx, '{foo=bar;};', 0, 0, function () { assert.deepEqual({'foo': 'bar'}, ctx); done(); }); stage.run(); }); });