it('should throw error for conflicting plugin config munge with config.xml config munge', function () { install_plugin(editconfigplugin_two); const platformJson = PlatformJson.load(plugins_dir, 'android'); platformJson.addInstalledPluginToPrepareQueue('org.test.editconfigtest_two', {}, true, true); const munger = new configChanges.PlatformMunger('android', temp, platformJson, pluginInfoProvider); munger.add_config_changes(cfg, true); expect(function () { munger.process(plugins_dir); }).toThrow(new Error('org.test.editconfigtest_two cannot be added. <edit-config> changes in this plugin conflicts with <edit-config> changes in config.xml. Conflicts must be resolved before plugin can be added.')); });
describe('parseElementtreeSync', function () { it('Test 001 : should parse xml with a byte order mark', function () { const xml_path = path.join(__dirname, '../fixtures/projects/windows-bom-test.xml'); expect(function () { xml_helpers.parseElementtreeSync(xml_path); }).not.toThrow(); }); });
it("should set logger on creation", () => { expect(() => TargetClient.create({ client: "client", organizationId: "orgId", logger: testLogger }) ).not.toThrow(); expect(utils.getLogger.calls.any()).toBe(true); const logger = utils.getLogger.calls.mostRecent().returnValue; expect(logger.debug).toEqual(jasmine.any(Function)); expect(logger.error).toEqual(jasmine.any(Function)); });
it('Test 022 : should not install plugin when there are edit-config conflicts', function () { install_plugin(editconfigplugin); install_plugin(editconfigplugin_two); const platformJson = PlatformJson.load(plugins_dir, 'android'); platformJson.addInstalledPluginToPrepareQueue('org.test.editconfigtest', {}); platformJson.addInstalledPluginToPrepareQueue('org.test.editconfigtest_two', {}); const munger = new configChanges.PlatformMunger('android', temp, platformJson, pluginInfoProvider); expect(function () { munger.process(plugins_dir); }).toThrow(new Error('There was a conflict trying to modify attributes with <edit-config> in plugin org.test.editconfigtest_two. The conflicting plugin, org.test.editconfigtest, already modified the same attributes. The conflict must be resolved before org.test.editconfigtest_two can be added. You may use --force to add the plugin and overwrite the conflicting attributes.')); });
it("should throw when options are missing", () => { expect(() => TargetClient.create({})).toThrow( new Error(Messages.OPTIONS_REQUIRED) ); });
describe('validateJSON', function () { const schema = require('./fixtures/testSchema.json'); it('returns gracefully if object is valid for a given schema', function () { expect(function () { sut.validateJSON({ firstName: 'John', lastName: 'Doe' }, schema); }).not.toThrow(); }); it('throws an error if object is not valid', function () { expect(function () { sut.validateJSON({ firstName: 'John' }, schema); }).toThrow(); }); });
it('Test 001 : should create an instance based on an xml file', function () { let cfg; expect(function () { cfg = new ConfigParser(xml); }).not.toThrow(); expect(cfg).toBeDefined(); expect(cfg.doc).toBeDefined(); });
it('Test 042 : should return an array that has a working map method', function () { expect(() => cfg.getStaticResources(null, 'icon').map(x => x) ).not.toThrow(); });
it("should throw when instantiated via new", () => { expect(() => new TargetClient()).toThrow( new Error(Messages.PRIVATE_CONSTRUCTOR) ); });
it('Test 002 : should throw when there is no plugin.xml file', function () { expect(() => new PluginInfo('/non/existent/dir')).toThrow(); });
it("should not throw when client and orgId are present", () => { expect(() => TargetClient.create({ client: "client", organizationId: "orgId" }) ).not.toThrow(); });
it("should throw when client is missing", () => { expect(() => TargetClient.create({ organizationId: "orgId" })).toThrow( new Error(Messages.CLIENT_REQUIRED) ); });
it("should throw when organization ID is missing", () => { expect(() => TargetClient.create({ client: "client" })).toThrow( new Error(Messages.ORG_ID_REQUIRED) ); });