Skip to content

Commit f226df9

Browse files
committed
fix(gen): remedy test failure
1 parent 689d0b2 commit f226df9

File tree

7 files changed

+25
-10
lines changed

7 files changed

+25
-10
lines changed

Diff for: src/generators/app/index.js

+13
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,14 @@ export class Generator extends Base {
542542
// Convert HTML into Pug
543543
if(this.filters.pug) {
544544
let pugFilter = filter(['**/*.html', '!client/_index.html'], {restore: true});
545+
546+
function pugReplacer(contents) {
547+
return contents
548+
.replace('ngif', 'ngIf')
549+
.replace('ngfor', 'ngFor')
550+
.replace('ngmodel', 'ngModel');
551+
}
552+
545553
this.registerTransformStream([
546554
pugFilter,
547555
html2jade({
@@ -552,6 +560,11 @@ export class Generator extends Base {
552560
rename(path => {
553561
path.extname = '.pug';
554562
}),
563+
tap(function(file, t) {
564+
var contents = file.contents.toString();
565+
contents = pugReplacer(contents);
566+
file.contents = new Buffer(contents);
567+
}),
555568
pugFilter.restore
556569
]);
557570
}

Diff for: src/test/get-expected-files.js

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ export function app(options) {
212212
/* WebSockets */
213213
if (options.ws) {
214214
files = files.concat([
215+
'client/components/socket/primus.mock.' + script,
215216
'client/components/socket/socket.service.' + script,
216217
'client/components/socket/socket.mock.' + script,
217218
'server/api/thing/thing.socket.js',

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ describe('angular-fullstack:app', function() {
255255
}
256256
});
257257

258-
describe('with sequelize models, auth', function() {
258+
describe.only('with sequelize models, auth', function() {
259259
var dir;
260260
var lintResult;
261261
var clientTestResult;

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

+6-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
ResponseOptions,
1515
} from '@angular/http';
1616
import { MockBackend } from '@angular/http/testing';
17-
<%_ if(filters.expect) { -%>
17+
<%_ if(filters.mocha && filters.expect) { -%>
1818
import { expect } from 'chai';<% } %><% if(filters.uibootstrap) { %>
1919
import { TooltipModule } from 'ngx-bootstrap';<% } %>
2020
import { FormsModule } from '@angular/forms';
@@ -49,15 +49,15 @@ describe('Component: MainComponent', function() {
4949
}).compileComponents();
5050
}));
5151
<%_ if(filters.ws) { %>
52-
beforeEach('mock backend', async(inject([MockBackend], (mockBackend) => {
52+
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
});
5858
})));<% } %>
5959

60-
beforeEach('ngOnInit', async(() => {
60+
beforeEach(async(() => {
6161
fixture = TestBed.createComponent(MainComponent);
6262
// MainComponent test instance
6363
comp = fixture.componentInstance;
@@ -68,7 +68,8 @@ describe('Component: MainComponent', function() {
6868
fixture.detectChanges();
6969
}));
7070

71-
it('should attach a list of things to the controller', () => {
72-
expect(comp.awesomeThings.length).to.equal(4);
71+
it('should attach a list of things to the controller', () => {<% if(filters.jasmine) { %>
72+
expect(comp.awesomeThings.length).toEqual(4);<% } else if(filters.mocha) { -%>
73+
<%= expect() %>comp.awesomeThings.length<%= to() %>.equal(4);<% } %>
7374
});
7475
});

Diff for: templates/app/client/components/oauth-buttons(oauth)/oauth-buttons.component.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { ComponentFixture, TestBed } from '@angular/core/testing';
33
import { By } from '@angular/platform-browser';
44
import { DebugElement } from '@angular/core';
5-
<%_ if(filters.expect) { -%>
5+
<%_ if(filters.mocha && filters.expect) { -%>
66
import { expect } from 'chai';<% } %>
77

88
import { OauthButtonsComponent } from './oauth-buttons.component';

Diff for: templates/app/client/components/util.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { safeCb } from './util';
2-
<%_ if(filters.expect) { -%>
2+
<%_ if(filters.mocha && filters.expect) { -%>
33
import { expect } from 'chai';<% } %>
44

55
describe('Util', () => {

Diff for: templates/app/tsconfig(ts).json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"compilerOptions": {
33
"allowJs": true,
44
"allowSyntheticDefaultImports": true,
5-
"baseDir": ".",
5+
"baseUrl": ".",
66
"experimentalDecorators": true,
77
"sourceMap": true,
88
"rootDir": "./",
99
"module": "es6",
10-
"outDir": ".tmp",<% if(filters.ws) %>
10+
"outDir": ".tmp",<% if(filters.ws) { %>
1111
"paths": {
1212
"primus": ["client/components/socket/primus.js"]
1313
},<% } %>

0 commit comments

Comments
 (0)