antonybudianto / angular-starter

:star: Gulp Angular Starter using TypeScript (Updated to 4.4.3)

Home Page:https://antonybudianto.github.io/angular-starter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Template URL not found

pgarge opened this issue · comments

Hi, I am using your example in our project structure and I am getting this error in tests that have TestComponentBuilder.

18 05 2016 10:30:30.601:WARN [web-server]: 404: /App/Loader/loader.html
PhantomJS 2.1.1 (Windows 7 0.0.0) LoadComponent should have been created success
fully FAILED
Failed: Uncaught (in promise): Failed to load App/Loader/loader.html
invoke@C:/acex/16.06/AppLib/CE.InsightsWeb/node_modules/zone.js/dist/zon
e.js:323:34
run@C:/acex/16.06/AppLib/CE.InsightsWeb/node_modules/zone.js/dist/zone.j
s:216:50
C:/acex/16.06/AppLib/CE.InsightsWeb/node_modules/zone.js/dist/zone.js:57
1:61
invokeTask@C:/acex/16.06/AppLib/CE.InsightsWeb/node_modules/zone.js/dist
/zone.js:356:43
runTask@C:/acex/16.06/AppLib/CE.InsightsWeb/node_modules/zone.js/dist/zo
ne.js:256:58
drainMicroTaskQueue@C:/acex/16.06/AppLib/CE.InsightsWeb/node_modules/zon
e.js/dist/zone.js:474:43
invoke@C:/acex/16.06/AppLib/CE.InsightsWeb/node_modules/zone.js/dist/zon

Here is the spec file:

`import {
it,
inject,
async,
describe,
expect
} from '@angular/core/testing';
import {
TestComponentBuilder,
ComponentFixture
} from '@angular/compiler/testing';
import { Component } from '@angular/core';
import { Loader } from '../Loader/loader';

@component({
selector: 'as-test',
template: '',
directives: [Loader]
})
class TestComponent {
}

let testFixture: ComponentFixture;
let todoCompiled;
let todoloadCmp: Loader;

describe('LoadComponent', () => {
it('should have been created successfully', async(inject([TestComponentBuilder],
(tcb: TestComponentBuilder) => {
tcb.createAsync(TestComponent).then((fixture) => {
testFixture = fixture;
fixture.detectChanges();

            todoCompiled = fixture.nativeElement;
            todoloadCmp = fixture.debugElement
                .children[0].componentInstance;
            expect(todoCompiled).toBeDefined();
        });
    })));

//it('should add todo successfully', () => {
//    //todolistCmp.todo = new Todo('test', true);
//    //todolistCmp.addTodo();
//    testFixture.detectChanges();

//    let items = todoCompiled.querySelectorAll('.acl-loader');
//    expect(items.length).toEqual(1);

//    //let item = items[items.length - 1];
//    //expect(item.querySelector('label').textContent).toEqual(' test');
//    //expect(item.querySelector('input[type="checkbox"]').checked).toBeTruthy();
//});

//it('should delete todo successfully', () => {
//    todolistCmp.delTodo(0);
//    testFixture.detectChanges();
//    expect(todoCompiled.querySelectorAll('.list-group-item').length)
//        .toEqual(2);
//});

});
`

Loader component:
`import {Component, OnInit, OnDestroy} from '@angular/core';

@component({
selector: 'Loader',
templateUrl: 'App/Loader/loader.html'
})

export class Loader implements OnInit, OnDestroy {
ngOnInit() {
//console.log('onInit');
}
ngOnDestroy() {
//console.log('onDestroy');
}
}`

All these files are in the same folder:

structure

Test runner works fine for service tests. Any help in this will be appreciated. Thanks!!

i'd no idea what's wrong, maybe case sensitive in karma proxies?

proxies: {
      // required for component assests fetched by Angular's compiler
      "/app/": "/base/app/"
    },

try change app to App
service test will normally works because no need for proxies

closing this because it's not the starter issue, but personal config issue