Skip to content

Commit 9513406

Browse files
committed
Add specs for GithubRepo object
1 parent cf57bf4 commit 9513406

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

spec/jquery.github.repo-spec.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
describe("jquery.github.repo", function() {
2+
3+
var instance;
4+
5+
beforeEach(function() {
6+
instance = new GithubRepo({
7+
name: "jquery-github",
8+
description: "A jQuery plugin to display your Github Repositories",
9+
forks: 33,
10+
pushed_at: "2013-07-02T00:08:36Z",
11+
url: "https://api.github.com/repos/zenorocha/jquery-github",
12+
watchers: 131
13+
});
14+
});
15+
16+
describe("initialize GithubRepo", function() {
17+
it("should be repository's name", function() {
18+
expect(instance.name)
19+
.toEqual("jquery-github");
20+
});
21+
22+
it("should be repository's description", function() {
23+
expect(instance.description)
24+
.toEqual("A jQuery plugin to display your Github Repositories");
25+
});
26+
27+
it("should be repository's number of forks", function() {
28+
expect(instance.forks)
29+
.toEqual(33);
30+
});
31+
32+
it("should be repository's last update date", function() {
33+
expect(instance.pushed_at)
34+
.toEqual("2013-07-02T00:08:36Z");
35+
});
36+
37+
it("should be repository's api url", function() {
38+
expect(instance.url)
39+
.toEqual("https://api.github.com/repos/zenorocha/jquery-github");
40+
});
41+
42+
it("should be repository's number of watchers", function() {
43+
expect(instance.watchers)
44+
.toEqual(131);
45+
});
46+
});
47+
48+
describe("execute _parsePushedDate", function() {
49+
it("should parse repository's pushed_at attribute", function() {
50+
expect(instance._parsePushedDate(instance.pushed_at))
51+
.toEqual("1/7/2013");
52+
});
53+
});
54+
55+
describe("execute _parseURL", function() {
56+
it("should parse repository's url attribute", function() {
57+
expect(instance._parseURL(instance.url))
58+
.toEqual("https://github.com/zenorocha/jquery-github");
59+
});
60+
});
61+
62+
describe("execute _parseURL", function() {
63+
// TODO
64+
});
65+
66+
});

0 commit comments

Comments
 (0)