fix: fixing tests

This commit is contained in:
Nathan Walker
2020-08-25 15:14:52 -07:00
parent 65bb0d96af
commit d07d4de651
2 changed files with 4 additions and 4 deletions

View File

@@ -798,7 +798,7 @@ export function test_parse_template_property() {
export function test_NonExistingElementError() {
var basePath = 'xml-declaration/';
var expectedErrorStart = 'Building UI from XML. @' + basePath + 'errors/non-existing-element.xml:11:5\n' + " > Module 'ui/unicorn' not found for element 'Unicorn'.";
var expectedErrorStart = 'Building UI from XML. @' + basePath + 'errors/non-existing-element.xml:11:5\n' + " > Module 'Unicorn' not found for element 'Unicorn'.";
var message;
try {
Builder.load('xml-declaration/errors/non-existing-element.xml');
@@ -810,7 +810,7 @@ export function test_NonExistingElementError() {
export function test_NonExistingElementInTemplateError() {
var basePath = 'xml-declaration/';
var expectedErrorStart = 'Building UI from XML. @' + basePath + 'errors/non-existing-element-in-template.xml:14:17\n' + " > Module 'ui/unicorn' not found for element 'Unicorn'.";
var expectedErrorStart = 'Building UI from XML. @' + basePath + 'errors/non-existing-element-in-template.xml:14:17\n' + " > Module 'Unicorn' not found for element 'Unicorn'.";
var message;
var page = Builder.load('xml-declaration/errors/non-existing-element-in-template.xml');
TKUnit.assert(page, 'Expected the xml to generate a page');

View File

@@ -95,13 +95,13 @@ const createComponentInstance = profile('createComponentInstance', (elementName:
}
// Get the component type from module.
const instanceType = instanceModule[elementName] || Object;
const instanceType = instanceModule[elementName];
// Create instance of the component.
instance = new instanceType();
} catch (ex) {
const debug: typeof debugModule = require('../../../utils/debug');
throw new debug.ScopeError(ex, "Module '" + resolvedModuleName + "' not found for element '" + (namespace ? namespace + ':' : '') + elementName + "'.");
throw new debug.ScopeError(ex, "Module '" + (resolvedModuleName || elementName) + "' not found for element '" + (namespace ? namespace + ':' : '') + elementName + "'.");
}
return { instance, instanceModule };