Skip to content

Commit b2d230c

Browse files
committed
fix test failures
1 parent 220097f commit b2d230c

File tree

7 files changed

+25
-24
lines changed

7 files changed

+25
-24
lines changed

Diff for: src/test/fixtures/.yo-rc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"filters": {
1616
"js": true,
1717
"babel": true,
18-
"flow": false,
18+
"flow": true,
1919
"html": true,
2020
"sass": true,
2121
"ngroute": true,

Diff for: src/test/main.test.js

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
const defaultOptions = {
1818
buildtool: 'gulp',
1919
transpiler: 'babel',
20+
flow: true,
2021
markup: 'html',
2122
stylesheet: 'sass',
2223
router: 'ngroute',
@@ -263,6 +264,7 @@ describe('angular-fullstack:app', function() {
263264
var testOptions = {
264265
buildtool: 'gulp',
265266
transpiler: 'babel',
267+
flow: true,
266268
markup: 'pug',
267269
stylesheet: 'css',
268270
router: 'ngroute',

Diff for: templates/app/client/app/admin(auth)/admin.module.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { NgModule } from '@angular/core';
2-
import { BrowserModule } from '@angular/platform-browser';
3-
<%_ if(filters.uirouter) { %>
4-
import { UIRouterModule } from 'ui-router-ng2';<% } %>
5-
<%_ if(filters.ngroute) { %>
2+
import { BrowserModule } from '@angular/platform-browser';<% if(filters.uirouter) { %>
3+
import { UIRouterModule } from 'ui-router-ng2';<% } %><% if(filters.ngroute) { %>
64
import { RouterModule, Routes } from '@angular/router';<% } %>
7-
5+
import { AuthGuard } from '../../components/auth/auth-guard.service';
86
import { AdminComponent } from './admin.component';
97

108
<%_ if(filters.uirouter) { -%>
@@ -13,6 +11,7 @@ import { STATES } from './admin.routes';<% } %>
1311
const adminRoutes: Routes = [{
1412
path: 'admin',
1513
component: AdminComponent,
14+
canActivate: [AuthGuard],
1615
}];<% } %>
1716

1817
@NgModule({

Diff for: templates/app/client/app/app.module.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ import { AuthHttp, AuthConfig } from 'angular2-jwt';
2525

2626
import { AppComponent } from './app.component';
2727
import { MainModule } from './main/main.module';
28-
import { DirectivesModule } from '../components/directives.module';
28+
import { DirectivesModule } from '../components/directives.module';<% if(filters.auth) { %>
2929
import { AccountModule } from './account/account.module';
30-
import { AdminModule } from './admin/admin.module';
30+
import { AdminModule } from './admin/admin.module';<% } %>
3131

3232
import constants from './app.constants';
3333

@@ -72,9 +72,9 @@ const appRoutes: Routes = [{ path: '',
7272
<%_ if (filters.ngroute) { -%>
7373
RouterModule.forRoot(appRoutes, { enableTracing: process.env.NODE_ENV === 'development' }),<% } %>
7474
MainModule,
75-
DirectivesModule,
75+
DirectivesModule,<% if(filters.auth) { %>
7676
AccountModule,
77-
AdminModule,
77+
AdminModule,<% } %>
7878
],
7979
declarations: [
8080
AppComponent,

Diff for: templates/app/client/app/main/main.component.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, OnInit<% if(filters.ws) { %>, OnDestroy<% } %> } from '@angular/core';
22
import { Http } from '@angular/http';
3-
import { Observable } from 'rxjs/Observable';
4-
import { SocketService } from '../../components/socket/socket.service';
3+
import { Observable } from 'rxjs/Observable';<% if(filters.ws) { %>
4+
import { SocketService } from '../../components/socket/socket.service';<% } %>
55

66
@Component({
77
selector: 'main',
@@ -16,7 +16,7 @@ export class MainComponent implements OnInit<% if(filters.ws) { %>, OnDestroy<%
1616
<%_ if(filters.models) { -%>
1717
newThing = '';<% } %>
1818

19-
static parameters = [Http, SocketService];
19+
static parameters = [Http<% if(filters.ws) { %>, SocketService<% } %>];
2020
constructor(<%= private() %>http: Http<% if(filters.ws) { %>, <%= private() %>socketService: SocketService<% } %>) {
2121
this.Http = http;
2222
<%_ if(filters.ws) { -%>

Diff for: templates/app/client/app/main/main.component.spec.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ import { MockBackend } from '@angular/http/testing';
1717
<%_ if(filters.mocha && filters.expect) { -%>
1818
import { expect } from 'chai';<% } %><% if(filters.uibootstrap) { %>
1919
import { TooltipModule } from 'ngx-bootstrap';<% } %>
20-
import { FormsModule } from '@angular/forms';
20+
import { FormsModule } from '@angular/forms';<% if(filters.ws) { %>
2121
import { SocketService } from '../../components/socket/socket.service';
22-
import { SocketServiceStub } from '../../components/socket/socket.mock';
22+
import { SocketServiceStub } from '../../components/socket/socket.mock';<% } %>
2323
import { MainComponent } from './main.component';
2424

2525
describe('Component: MainComponent', function() {
@@ -43,19 +43,19 @@ describe('Component: MainComponent', function() {
4343
return new Http(backend, defaultOptions);
4444
},<%_ if(filters.ws) { %>
4545
deps: [MockBackend, BaseRequestOptions]<% } %>
46-
},
47-
{ provide: SocketService, useClass: SocketServiceStub },
46+
},<% if(filters.ws) { %>
47+
{ provide: SocketService, useClass: SocketServiceStub },<% } %>
4848
],
4949
}).compileComponents();
5050
}));
51-
<%_ if(filters.ws) { %>
51+
5252
beforeEach(async(inject([MockBackend], (mockBackend) => {
5353
mockBackend.connections.subscribe(conn => {
5454
conn.mockRespond(new Response(new ResponseOptions({
5555
body: JSON.stringify(['HTML5 Boilerplate', 'AngularJS', 'Karma', 'Express'])
5656
})));
5757
});
58-
})));<% } %>
58+
})));
5959

6060
beforeEach(async(() => {
6161
fixture = TestBed.createComponent(MainComponent);

Diff for: templates/app/client/components/directives.module.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { CollapseModule } from 'ngx-bootstrap';<% } %>
77
import { UIRouterModule } from 'ui-router-ng2';<% } %>
88
<%_ if (filters.ngroute) { -%>
99
import { RouterModule } from '@angular/router';<% } %>
10-
11-
import { AuthModule } from './auth/auth.module';
10+
<% if(filters.auth) { %>
11+
import { AuthModule } from './auth/auth.module';<% } %>
1212

1313
import { NavbarComponent } from './navbar/navbar.component';
1414
import { FooterComponent } from './footer/footer.component';
@@ -17,9 +17,9 @@ import { OauthButtonsComponent } from './oauth-buttons/oauth-buttons.component';
1717

1818
@NgModule({
1919
imports: [
20-
CommonModule,
21-
<% if(filters.uibootstrap) { %>CollapseModule,<% } %>
22-
AuthModule,
20+
CommonModule,<% if(filters.uibootstrap) { %>
21+
CollapseModule,<% } %><% if(filters.auth) { %>
22+
AuthModule,<% } %>
2323
<%_ if (filters.uirouter) { -%>
2424
UIRouterModule,<% } %>
2525
<%_ if (filters.ngroute) { -%>

0 commit comments

Comments
 (0)