Skip to content

Commit d08a8e2

Browse files
committed
Adds a missing test
The last one, in fact.
1 parent e8fff33 commit d08a8e2

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

TESTING.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ Currently there are a number of fields and functions in NodeGit that have no tes
1111
npm run generateMissingTests
1212
```
1313

14+
>You should have run already `npm install .` or it will complain about
15+
> missing `nodegit-promise` or suchlike
16+
1417
This will make the file `generate/output/missing-tests.json` which will contain info for tests or files that are currently missing.
1518

1619
From this file you can find fields and functions that don't have any tests yet and pick one to work on.
@@ -32,13 +35,14 @@ In the `missing-tests.json` file you'll see it formatted like so:
3235

3336
In the file each `{className}` corresponds to a file found at `test/tests/{classname}`. Each entry in either `fields` or `functions` is a missing test for the respective field/function.
3437

35-
In the file that your test is going in you can just append it to the file inside of the `describe` function block.
38+
In the file that your test is going in you can just append it to the file inside the `describe` function block.
3639

3740
It can be helpful to reference the [libgit2 API docs](https://libgit2.github.com/libgit2/#v0.21.4) to know what the field or function is doing inside of libgit2 and referencing the [NodeGit API docs](http://www.nodegit.org/) can also help. Looking at examples inside of `/examples` can show you how we wrap the libgit2 library and how you can call into it from JavaScript.
3841

3942
The idea is to test the basic functionality of the field/function and to confirm that it's returning or setting the value(s) correctly. Bugs inside of libgit2 will have to either have a work-around or be ignored.
4043

41-
If a specific field or function is further wrapped via a file inside of `/lib` then as long as that wrapper is called and tested.
44+
If a specific field or function is further wrapped via a file inside
45+
of `/lib` then as long as that wrapper is called and tested it is OK.
4246

4347
You can mark something to be ignored inside of the `/generate/missing-tests-ignore.json` file.
4448

test/tests/tree_entry.js

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ describe("TreeEntry", function() {
3939
});
4040
});
4141

42+
it("provides the correct length for a file", function() {
43+
return this.commit.getEntry("README.md")
44+
.then(function(entry) {
45+
assert.equal(entry.filenameLen(), 9);
46+
});
47+
});
48+
4249
it("provides the filename", function() {
4350
return this.commit.getEntry("test/raw-commit.js")
4451
.then(function(entry) {

0 commit comments

Comments
 (0)