Skip to content

Commit a58831a

Browse files
committed
Moved all remaining js files in src to models folder
1 parent 3ada558 commit a58831a

File tree

9 files changed

+69
-48
lines changed

9 files changed

+69
-48
lines changed

spec/Flow-spec.js

-45
This file was deleted.

spec/models/Flow-spec.js

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
var jasminePit = require('jasmine-pit');
2+
jasminePit.install(global);
3+
var models = require('../../src/models');
4+
5+
describe('Flow', function() {
6+
it('should be able to require Flow', function() {
7+
expect(models.Flow).toBeDefined(models.Flow);
8+
});
9+
10+
it('should have static method `init` and `isInitialized` on Flow object', function() {
11+
expect(models.Flow.init).toEqual(jasmine.any(Function));
12+
expect(models.Flow.isInitialized).toEqual(jasmine.any(Function));
13+
});
14+
15+
describe('Init', function() {
16+
beforeEach(function() {
17+
var repoConfig = {
18+
setString: function() {
19+
return Promise.resolve();
20+
}
21+
};
22+
this.repo = {
23+
config: function() {
24+
return Promise.resolve(repoConfig);
25+
}
26+
};
27+
});
28+
29+
30+
pit('should throw error if no repository is passed', function() {
31+
return models.Flow.init()
32+
.then(function() {
33+
fail();
34+
})
35+
.catch(function(reason) {
36+
expect(reason).toEqual(jasmine.any(Error));
37+
});
38+
});
39+
40+
pit('should return new flow object if repository is passed', function() {
41+
return models.Flow.init(this.repo)
42+
.then(function(flow) {
43+
expect(flow.startFeature).toEqual(jasmine.any(Function));
44+
expect(flow.startFeature).toEqual(jasmine.any(Function));
45+
expect(flow.startHotfix).toEqual(jasmine.any(Function));
46+
expect(flow.startHotfix).toEqual(jasmine.any(Function));
47+
expect(flow.startRelease).toEqual(jasmine.any(Function));
48+
expect(flow.startRelease).toEqual(jasmine.any(Function));
49+
});
50+
});
51+
});
52+
53+
describe('Static methods', function() {
54+
it('should contain all of the static methods', function() {
55+
expect(models.Flow.startFeature).toEqual(jasmine.any(Function));
56+
expect(models.Flow.startFeature).toEqual(jasmine.any(Function));
57+
expect(models.Flow.startHotfix).toEqual(jasmine.any(Function));
58+
expect(models.Flow.startHotfix).toEqual(jasmine.any(Function));
59+
expect(models.Flow.startRelease).toEqual(jasmine.any(Function));
60+
expect(models.Flow.startRelease).toEqual(jasmine.any(Function));
61+
});
62+
});
63+
});

src/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
var nodegit = require('nodegit');
22
var utils = require('./utils');
3+
var models = require('./models');
34

45
var flow = nodegit.Flow = {};
56

6-
utils.Assign(flow, require('./Config'));
7-
utils.Assign(flow, require('./Flow'));
7+
utils.Assign(flow, models.Config);
8+
utils.Assign(flow, models.Flow);
89

910
module.exports = nodegit;
File renamed without changes.
File renamed without changes.

src/Flow.js renamed to src/models/Flow.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var utils = require('./utils');
1+
var utils = require('../utils');
22
var Config = require('./Config');
33
var Feature = require('./Feature');
44
var Hotfix = require('./Hotfix');
File renamed without changes.
File renamed without changes.

src/models/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var FolderLoader = require('../utils/FolderLoader');
2+
FolderLoader(__dirname, module.exports, '.js');

0 commit comments

Comments
 (0)