Skip to content

Commit 05f7f43

Browse files
committed
fix(server): fix seeding of db in test mode causing tests to randomly fail
seeding of db will now be disabled by default for all environments, but will be enabled for the development environment closes angular-fullstack#352
1 parent eb7d50c commit 05f7f43

File tree

5 files changed

+5
-15
lines changed

5 files changed

+5
-15
lines changed

app/templates/e2e/main/main.po.js

-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ var MainPage = function() {
99
this.heroEl = element(by.css('.hero-unit'));
1010
this.h1El = this.heroEl.element(by.css('h1'));
1111
this.imgEl = this.heroEl.element(by.css('img'));
12-
this.anchorEl = this.heroEl.element(by.css('a'));
13-
14-
this.repeater = by.repeater('thing in awesomeThings');
15-
this.firstAwesomeThingNameEl = element(this.repeater.row(0).column('{{thing.name}}'));
16-
this.awesomeThingsCount = element.all(this.repeater).count();
1712
};
1813

1914
module.exports = new MainPage();

app/templates/e2e/main/main.spec.js

-7
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,4 @@ describe('Main View', function() {
1313
expect(page.imgEl.getAttribute('src')).toMatch(/assets\/images\/yeoman.png$/);
1414
expect(page.imgEl.getAttribute('alt')).toBe('I\'m Yeoman');
1515
});
16-
17-
it('should render awesomeThings', function() {
18-
expect(page.firstAwesomeThingNameEl.getText()).toContain('Development Tools');
19-
page.awesomeThingsCount.then(function(count) {
20-
expect(count).toBe(6);
21-
});
22-
});
2316
});

app/templates/server/api/user(auth)/user.model.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var user = new User({
1212
});
1313

1414
describe('User Model', function() {
15-
beforeEach(function(done) {
15+
before(function(done) {
1616
// Clear users before testing
1717
User.remove().exec().then(function() {
1818
done();

app/templates/server/config/environment/development.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ module.exports = {
66
// MongoDB connection options
77
mongo: {
88
uri: 'mongodb://localhost/<%= _.slugify(appname) %>-dev'
9-
}
9+
},
10+
11+
seedDB: true
1012
};

app/templates/server/config/environment/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var all = {
2222
port: process.env.PORT || 9000,
2323

2424
// Should we populate the DB with sample data?
25-
seedDB: true,
25+
seedDB: false,
2626

2727
// Secret for session, you will want to change this and make it an environment variable
2828
secrets: {

0 commit comments

Comments
 (0)