Skip to content

Instantly share code, notes, and snippets.

@Toxicable
Created September 12, 2019 21:52
Show Gist options
  • Save Toxicable/a36f94293a1be43eea8c10eb21ad4779 to your computer and use it in GitHub Desktop.
Save Toxicable/a36f94293a1be43eea8c10eb21ad4779 to your computer and use it in GitHub Desktop.
angular jasmine nodejs test
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define("test.spec.js", ["require", "exports", "tslib", "@angular/core/testing", "@angular/platform-browser-dynamic/testing", "@angular/core", "zone.js/dist/zone-node", "zone.js/dist/zone-testing", "core-js/es/reflect"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const testing_1 = require("@angular/core/testing");
const testing_2 = require("@angular/platform-browser-dynamic/testing");
const core_1 = require("@angular/core");
require("zone.js/dist/zone-node");
require("zone.js/dist/zone-testing");
require("core-js/es/reflect");
let MyComponent = class MyComponent {
};
MyComponent = tslib_1.__decorate([
core_1.Component({
template: 'hello!',
})
], MyComponent);
testing_1.getTestBed().initTestEnvironment(testing_2.BrowserDynamicTestingModule, testing_2.platformBrowserDynamicTesting());
fdescribe('browser testing', () => {
beforeEach(() => { });
it('should run', async () => {
await testing_1.TestBed.configureTestingModule({
declarations: [MyComponent],
}).compileComponents();
const fixture = testing_1.TestBed.createComponent(MyComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxlbmQtYm9tLnNlcnZpY2Uuc3BlYy5qcyIsInNvdXJjZVJvb3QiOiIvaG9tZS9mLndpbGVzL3dvcmtzcGFjZS9zb2EvIiwic291cmNlcyI6WyJhcHBzL3BlZGlncmVlL2JlL3NyYy9zZXJ2aWNlcy9ibGVuZC9ibGVuZC1ib20uc2VydmljZS5zcGVjLnRzIl0sIm5hbWVzIjp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ydXRoeSgpO1xuICB9KTtcbn0pO1xuIl19
import { TestBed, getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
import { Component } from '@angular/core';
import 'zone.js/dist/zone-node';
import 'zone.js/dist/zone-testing';
import 'core-js/es/reflect';
@Component({
template: 'hello!',
})
class MyComponent {}
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
fdescribe('browser testing', () => {
beforeEach(() => {});
it('should run', async () => {
await TestBed.configureTestingModule({
declarations: [MyComponent],
}).compileComponents();
const fixture = TestBed.createComponent(MyComponent);
const app: MyComponent = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment