Skip to content

Ng Test Example?  #17

@TylerOrtiz

Description

@TylerOrtiz

Is there an example in here for running an Angular unit test?

I tried adding the BreezeBridgeHttpClientModule to the imports of the testbed but the test seems to be trying to initiate real requests rather than mocking them.
Test fixture snippet:

 beforeEach(async(() => {
        TestBed.configureTestingModule({
            imports: [FormsModule, HttpClientModule, RouterTestingModule, BreezeBridgeHttpClientModule],
            declarations: [SearchResultsComponent]
        })
        .compileComponents();
    }));

Test result snippet:

Failed: Uncaught (in promise): Error: Metadata query failed for: service/Metadata; NOT FOUND
Error: Metadata query failed for: service/Metadata; NOT FOUND
    at createError (http://localhost:9876/_karma_webpack_/webpack:/node_modules/breeze-client/breeze.debug.js:16247:1)
    at handleHttpError (http://localhost:9876/_karma_webpack_/webpack:/node_modules/breeze-client/breeze.debug.js:16237:1)
    at Object.error (http://localhost:9876/_karma_webpack_/webpack:/node_modules/breeze-client/breeze.debug.js:16036:1)
    at SafeSubscriber.errorFn [as _error] (http://localhost:9876/_karma_webpack_/webpack:/node_modules/breeze-bridge2-angular/index.js:172:1)
    at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (http://localhost:9876/_karma_webpack_/webpack:/node_modules/rxjs/_esm5/internal/Subscriber.js:195:1)
    at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.error (http://localhost:9876/_karma_webpack_/webpack:/node_modules/rxjs/_esm5/internal/Subscriber.js:146:1)
    at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (http://localhost:9876/_karma_webpack_/webpack:/node_modules/rxjs/_esm5/internal/Subscriber.js:80:1)
    at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (http://localhost:9876/_karma_webpack_/webpack:/node_modules/rxjs/_esm5/internal/Subscriber.js:60:1)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._error (http://localhost:9876/_karma_webpack_/webpack:/node_modules/rxjs/_esm5/internal/Subscriber.js:80:1)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.error (http://localhost:9876/_karma_webpack_/webpack:/node_modules/rxjs/_esm5/internal/Subscriber.js:60:1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions