-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating code. cleaup. refactoring. updating tests
- Loading branch information
1 parent
7a53f23
commit 96625b5
Showing
11 changed files
with
128 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ test-ci: | |
$(TESTS) | ||
|
||
|
||
.PHONY: test | ||
.PHONY: test test-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
TESTS = test/*.coffee | ||
|
||
test: | ||
@NODE_ENV=test ./node_modules/.bin/mocha \ | ||
--require coffee-script \ | ||
--reporter list \ | ||
$(TESTS) | ||
|
||
test-ci: | ||
@NODE_ENV=test ./node_modules/.bin/mocha \ | ||
--require coffee-script \ | ||
--reporter json \ | ||
$(TESTS) | ||
|
||
|
||
.PHONY: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
Dao = require("./dao").Dao | ||
|
||
class ObjectsDao extends Dao | ||
## ObjectsDao | ||
## ------------- | ||
## Base Dao for all Git Objects: Blob, Commit, Tree, Tag. | ||
class exports.ObjectsDao extends Dao | ||
|
||
constructor: (log) -> super "objects", log | ||
|
||
populateEntity: (meta, attributes) => | ||
super meta, attributes | ||
|
||
# Get link to repository. Can be `null`. | ||
getRepository: (links) => @getLink links, "repository" | ||
|
||
exports.ObjectsDao = ObjectsDao | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,122 @@ | ||
should = require "should" | ||
MassiveGit = new (require("../lib/massive.git").MassiveGit)() | ||
|
||
describe "fake", -> | ||
describe "repo", -> | ||
it "should not exists", -> | ||
describe "MassiveGit", -> | ||
describe "#getRepo('fake-repo-id')", -> | ||
it "return 'Repo wasn't found' error", (done) -> | ||
MassiveGit.getRepo "fake-repo-id", (err, repo) -> | ||
err.should.exist | ||
err.should.have.property "message", "Repo wasn't found" | ||
err.should.have.property "statusCode", 400 | ||
should.not.exist repo | ||
describe "blob", -> | ||
it "should not exists", -> | ||
MassiveGit.getBlob "fake-blob-id", (err, repo) -> | ||
done() | ||
describe "#getBlob('fake-blob-id')", -> | ||
it "return 'Blob wasn't found' error", (done) -> | ||
MassiveGit.getBlob "fake-blob-id", (err, blob) -> | ||
err.should.exist | ||
err.should.have.property "message", "Blob wasn't found" | ||
err.should.have.property "statusCode", 400 | ||
should.not.exist repo | ||
describe "commit", -> | ||
it "should not exists", -> | ||
MassiveGit.getCommit "fake-commit-id", (err, repo) -> | ||
should.not.exist blob | ||
done() | ||
describe "#getCommit('fake-commit-id')", -> | ||
it "return 'Commit wasn't found' error", (done) -> | ||
MassiveGit.getCommit "fake-commit-id", (err, commit) -> | ||
err.should.exist | ||
err.should.have.property "message", "Commit wasn't found" | ||
err.should.have.property "statusCode", 400 | ||
should.not.exist repo | ||
describe "tree", -> | ||
it "should not exists", -> | ||
MassiveGit.getTree "fake-tree-id", (err, repo) -> | ||
should.not.exist commit | ||
done() | ||
describe "#getTree('fake-tree-id')", -> | ||
it "return 'Tree wasn't found' error", (done) -> | ||
MassiveGit.getTree "fake-tree-id", (err, tree) -> | ||
err.should.exist | ||
err.should.have.property "message", "Tree wasn't found" | ||
err.should.have.property "statusCode", 400 | ||
should.not.exist repo | ||
|
||
|
||
describe "when id is null", -> | ||
describe "for repo", -> | ||
it "should return 'Invalid parameters' error", -> | ||
should.not.exist tree | ||
done() | ||
describe "#getBlobs('fake-tree-id')", -> | ||
it "return 'Cannot retrive blobs' error", (done) -> | ||
MassiveGit.getBlobs "fake-tree-id", (err, blobs) -> | ||
blobs.length.should.equal 0 | ||
done err | ||
describe "#getRepo(null)", -> | ||
it "return 'Invalid parameters' error", (done) -> | ||
MassiveGit.getRepo null, (err, repo) -> | ||
err.should.exist | ||
err.should.have.property "message", "Invalid parameters" | ||
err.should.have.property "statusCode", 422 | ||
should.not.exist repo | ||
describe "for blob", -> | ||
it "should return 'Invalid parameters' error", -> | ||
MassiveGit.getBlob null, (err, repo) -> | ||
done() | ||
describe "#getBlob(null)", -> | ||
it "return 'Invalid parameters' error", (done) -> | ||
MassiveGit.getBlob null, (err, blob) -> | ||
err.should.exist | ||
err.should.have.property "message", "Invalid parameters" | ||
err.should.have.property "statusCode", 422 | ||
should.not.exist repo | ||
describe "for commit", -> | ||
it "should return 'Invalid parameters' error", -> | ||
MassiveGit.getCommit null, (err, repo) -> | ||
should.not.exist blob | ||
done() | ||
describe "#getCommit(null)", -> | ||
it "return 'Invalid parameters' error", -> | ||
MassiveGit.getCommit null, (err, commit) -> | ||
err.should.exist | ||
err.should.have.property "message", "Invalid parameters" | ||
err.should.have.property "statusCode", 422 | ||
should.not.exist repo | ||
describe "for tree", -> | ||
it "should return 'Invalid parameters' error", -> | ||
MassiveGit.getTree null, (err, repo) -> | ||
should.not.exist commit | ||
describe "#getTree(null)", -> | ||
it "return 'Invalid parameters' error", (done) -> | ||
MassiveGit.getTree null, (err, tree) -> | ||
err.should.exist | ||
err.should.have.property "message", "Invalid parameters" | ||
err.should.have.property "statusCode", 422 | ||
should.not.exist repo | ||
|
||
describe "when id is undefined", -> | ||
describe "for repo", -> | ||
it "should return 'Invalid parameters' error", -> | ||
should.not.exist tree | ||
done() | ||
describe "#getBlobs(null)", -> | ||
it "return 'Invalid parameters' error", (done) -> | ||
MassiveGit.getBlobs null, (err, blobs) -> | ||
err.should.exist | ||
err.should.have.property "message", "Invalid parameters" | ||
err.should.have.property "statusCode", 422 | ||
should.not.exist blobs | ||
done() | ||
describe "#getRepo(undefined)", -> | ||
it "return 'Invalid parameters' error", (done) -> | ||
MassiveGit.getRepo undefined, (err, repo) -> | ||
err.should.exist | ||
err.should.have.property "message", "Invalid parameters" | ||
err.should.have.property "statusCode", 422 | ||
should.not.exist repo | ||
describe "for blob", -> | ||
it "should return 'Invalid parameters' error", -> | ||
MassiveGit.getBlob undefined, (err, repo) -> | ||
done() | ||
describe "#getBlob(undefined)", -> | ||
it "return 'Invalid parameters' error", (done) -> | ||
MassiveGit.getBlob undefined, (err, blob) -> | ||
err.should.exist | ||
err.should.have.property "message", "Invalid parameters" | ||
err.should.have.property "statusCode", 422 | ||
should.not.exist repo | ||
describe "for commit", -> | ||
it "should return 'Invalid parameters' error", -> | ||
MassiveGit.getCommit undefined, (err, repo) -> | ||
should.not.exist blob | ||
done() | ||
describe "#getCommit(undefined)", -> | ||
it "return 'Invalid parameters' error", (done) -> | ||
MassiveGit.getCommit undefined, (err, commit) -> | ||
err.should.exist | ||
err.should.have.property "message", "Invalid parameters" | ||
err.should.have.property "statusCode", 422 | ||
should.not.exist repo | ||
describe "for tree", -> | ||
it "should return 'Invalid parameters' error", -> | ||
MassiveGit.getTree undefined, (err, repo) -> | ||
should.not.exist commit | ||
done() | ||
describe "#getTree(undefined)", -> | ||
it "return 'Invalid parameters' error", (done) -> | ||
MassiveGit.getTree undefined, (err, tree) -> | ||
err.should.exist | ||
err.should.have.property "message", "Invalid parameters" | ||
err.should.have.property "statusCode", 422 | ||
should.not.exist repo | ||
|
||
should.not.exist tree | ||
done() | ||
describe "#getBlobs(undefined)", -> | ||
it "return 'Invalid parameters' error", (done) -> | ||
MassiveGit.getBlobs undefined, (err, blobs) -> | ||
err.should.exist | ||
err.should.have.property "message", "Invalid parameters" | ||
err.should.have.property "statusCode", 422 | ||
should.not.exist blobs | ||
done() | ||
|
||
|