@@ -24,23 +24,65 @@ describe("Commit", function() {
2424 } ) ;
2525 } ) ;
2626
27- it ( "makes its message available" , function ( ) {
27+ it ( "will fail with an invalid sha" , function ( ) {
28+ return this . repository . getCommit ( "invalid" ) . then ( null , function ( error ) {
29+ assert . ok ( error instanceof Error ) ;
30+ } ) ;
31+ } ) ;
32+
33+ it ( "has a message" , function ( ) {
2834 assert . equal ( this . commit . message ( ) , "Update README.md" ) ;
2935 } ) ;
3036
31- it ( "makes its sha available " , function ( ) {
37+ it ( "has a sha" , function ( ) {
3238 assert . equal ( this . commit . sha ( ) , historyCountKnownSHA ) ;
3339 } ) ;
3440
35- it ( "makes its time available " , function ( ) {
41+ it ( "has a time" , function ( ) {
3642 assert . equal ( this . commit . timeMs ( ) , 1362012884000 ) ;
3743 } ) ;
3844
39- it ( "makes its date available " , function ( ) {
45+ it ( "has a date" , function ( ) {
4046 assert . equal ( this . commit . date ( ) . getTime ( ) , 1362012884000 ) ;
4147 } ) ;
4248
43- it ( "makes its offset available " , function ( ) {
49+ it ( "has an offset" , function ( ) {
4450 assert . equal ( this . commit . offset ( ) , 780 ) ;
4551 } ) ;
52+
53+ describe ( "author" , function ( ) {
54+ before ( function ( ) {
55+ this . author = this . commit . author ( ) ;
56+ } ) ;
57+
58+ it ( "is available" , function ( ) {
59+ assert . ok ( this . author instanceof nodegit . Signature ) ;
60+ } ) ;
61+
62+ it ( "has a name" , function ( ) {
63+ assert . equal ( this . author . name ( ) , "Michael Robinson" ) ;
64+ } ) ;
65+
66+ it ( "has an email" , function ( ) {
67+ assert . equal ( this . author . email ( ) , "mike@panmedia.co.nz" ) ;
68+ } ) ;
69+ } ) ;
70+
71+ describe ( "committer" , function ( ) {
72+ before ( function ( ) {
73+ this . author = this . commit . committer ( ) ;
74+ } ) ;
75+
76+ it ( "is available" , function ( ) {
77+ assert . ok ( this . author instanceof nodegit . Signature ) ;
78+ } ) ;
79+
80+ it ( "has a name" , function ( ) {
81+ assert . equal ( this . author . name ( ) , "Michael Robinson" ) ;
82+ } ) ;
83+
84+ it ( "has an email" , function ( ) {
85+ assert . equal ( this . author . email ( ) , "mike@panmedia.co.nz" ) ;
86+ } ) ;
87+ } ) ;
4688} ) ;
0 commit comments