it('Test 025 : should allow adding a new plugin', function () { cfg.addPlugin({ name: 'myplugin' }); const plugins = cfg.doc.findall('plugin'); const pluginNames = plugins.map(function (plugin) { return plugin.attrib.name; }); expect(pluginNames).toContain('myplugin'); });
it('Test 037 : should merge singleton name with clobber', function () { const testXml = et.XML('<widget><name>SUPER_NAME</name></widget>'); xml_helpers.mergeXml(testXml, dstXml, '', true); const testElements = dstXml.findall('name'); expect(testElements).toBeDefined(); expect(testElements.length).toEqual(1); expect(testElements[0].text).toContain('SUPER_NAME'); });
describe('PluginInfoProvider', function () { describe('getAllWithinSearchPath', function () { it('Test 001 : should load all plugins in a dir', function () { const pluginInfoProvider = new PluginInfoProvider(); const plugins = pluginInfoProvider.getAllWithinSearchPath(pluginsDir); expect(plugins.length).not.toBe(0); expect(plugins).toContain(jasmine.objectContaining({ id: 'org.test.scoped', dir: path.join(pluginsDir, '@scope/test') })); }); }); });
describe('AppComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ AppComponent ], }).compileComponents(); })); it('should create the app', async(() => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; expect(app).toBeTruthy(); })); it(`should have as title 'client'`, async(() => { const fixture = TestBed.createComponent(AppComponent); const app = fixture.debugElement.componentInstance; expect(app.title).toEqual('client'); })); it('should render title in a h1 tag', async(() => { const fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); const compiled = fixture.debugElement.nativeElement; expect(compiled.querySelector('h1').textContent).toContain('Welcome to client!'); })); });
it('Test 018 : should read plugin id list', function () { const expectedList = [ 'org.apache.cordova.pluginwithvars', 'org.apache.cordova.pluginwithurl', 'org.apache.cordova.pluginwithversion', 'org.apache.cordova.pluginwithurlandversion', 'org.apache.cordova.justaplugin', 'org.apache.cordova.legacyfeatureversion', 'org.apache.cordova.legacyfeatureurl', 'org.apache.cordova.legacyfeatureversionandurl' ]; const list = cfg.getPluginIdList(); expect(list.length).toEqual(expectedList.length); expectedList.forEach(function (plugin) { expect(list).toContain(plugin); }); });
it('Test 034 : should merge singleton children without clobber', function () { const testXml = et.XML('<widget><author testAttrib="value" href="http://www.nowhere.com">SUPER_AUTHOR</author></widget>'); xml_helpers.mergeXml(testXml, dstXml); const testElements = dstXml.findall('author'); expect(testElements).toBeDefined(); expect(testElements.length).toEqual(1); expect(testElements[0].attrib.testAttrib).toEqual('value'); expect(testElements[0].attrib.href).toEqual('http://cordova.io'); expect(testElements[0].attrib.email).toEqual('dev@cordova.apache.org'); expect(testElements[0].text).toContain('Apache Cordova Team'); });
); expect(await SwagDetailsPage.getText()).toContain( product, 'Swag Item detail page did not show the right text',
it('Test 031 : it should remove given legacy feature id', function () { cfg.removePlugin('org.apache.cordova.legacyplugin'); const plugins = cfg.doc.findall('feature'); const pluginNames = plugins.map(function (plugin) { return plugin.attrib.name; }); expect(pluginNames).not.toContain('org.apache.cordova.legacyplugin'); });
it('Test 035 : should merge singleton name without clobber', function () { const testXml = et.XML('<widget><name>SUPER_NAME</name></widget>'); xml_helpers.mergeXml(testXml, dstXml); const testElements = dstXml.findall('name'); expect(testElements).toBeDefined(); expect(testElements.length).toEqual(1); expect(testElements[0].text).toContain('Hello Cordova'); });
it('Test 030 : it should remove given plugin', function () { cfg.removePlugin('org.apache.cordova.justaplugin'); const plugins = cfg.doc.findall('plugin'); const pluginNames = plugins.map(function (plugin) { return plugin.attrib.name; }); expect(pluginNames).not.toContain('org.apache.cordova.justaplugin'); });