fbe 0.0.57 → 0.0.59
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fbe/github_graph.rb +34 -23
- data/lib/fbe/octo.rb +4 -1
- data/lib/fbe.rb +1 -1
- data/test/fbe/test_github_graph.rb +31 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcb7a83f13eadb9bd57bd7a4741709a4b41622109f64e716ffabe98df60f2e7e
|
4
|
+
data.tar.gz: b854b1108dc729e24cee35970cefc92387c4e44c0a171c3991a162a819e7e256
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95584b9296deb9707f364d29b8351505f70e12273c3df3794704535febd965a18f0777318ec8d445a51bcc2309453820094039354e1d3dc3f82aa50635f81b1c
|
7
|
+
data.tar.gz: a2893b12fef6a7f24ffda4ac0152c08500ac58a9ac27e6bc9e32ae3ba329b7b8f781dbfae7514bd6ade9b0c9fff38ac109706f1e2a6d8a67b7631b8a6a1be020
|
data/lib/fbe/github_graph.rb
CHANGED
@@ -82,7 +82,9 @@ class Fbe::Graph
|
|
82
82
|
}
|
83
83
|
GRAPHQL
|
84
84
|
)
|
85
|
-
result
|
85
|
+
result&.to_h&.dig('repository', 'pullRequest', 'reviewThreads', 'nodes')&.select do |thread|
|
86
|
+
thread['isResolved']
|
87
|
+
end || []
|
86
88
|
end
|
87
89
|
|
88
90
|
def total_commits(owner, name, branch)
|
@@ -124,29 +126,38 @@ class Fbe::Graph
|
|
124
126
|
{}
|
125
127
|
end
|
126
128
|
|
127
|
-
def resolved_conversations(
|
128
|
-
|
129
|
-
|
130
|
-
'
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
129
|
+
def resolved_conversations(owner, name, _number)
|
130
|
+
data = {
|
131
|
+
zerocracy_baza: [
|
132
|
+
conversation('PRRT_kwDOK2_4A85BHZAR')
|
133
|
+
]
|
134
|
+
}
|
135
|
+
data[:"#{owner}_#{name}"] || []
|
136
|
+
end
|
137
|
+
|
138
|
+
private
|
139
|
+
|
140
|
+
def conversation(id)
|
141
|
+
{
|
142
|
+
'id' => id,
|
143
|
+
'isResolved' => true,
|
144
|
+
'comments' => {
|
145
|
+
'nodes' => [
|
146
|
+
{
|
147
|
+
'id' => 'PRRC_kwDOK2_4A85l3obO',
|
148
|
+
'body' => 'first message',
|
149
|
+
'author' => { '__typename' => 'User', 'login' => 'reviewer' },
|
150
|
+
'createdAt' => '2024-08-08T09:41:46Z'
|
151
|
+
},
|
152
|
+
{
|
153
|
+
'id' => 'PRRC_kwDOK2_4A85l3yTp',
|
154
|
+
'body' => 'second message',
|
155
|
+
'author' => { '__typename' => 'User', 'login' => 'programmer' },
|
156
|
+
'createdAt' => '2024-08-08T10:01:55Z'
|
157
|
+
}
|
158
|
+
]
|
148
159
|
}
|
149
|
-
|
160
|
+
}
|
150
161
|
end
|
151
162
|
end
|
152
163
|
end
|
data/lib/fbe/octo.rb
CHANGED
data/lib/fbe.rb
CHANGED
@@ -80,6 +80,23 @@ class TestGitHubGraph < Minitest::Test
|
|
80
80
|
g = Fbe.github_graph(options:, loog: Loog::NULL, global:)
|
81
81
|
result = g.resolved_conversations('zerocracy', 'baza', 172)
|
82
82
|
assert_equal(1, result.count)
|
83
|
+
result = g.resolved_conversations('zerocracy', 'baza', 0)
|
84
|
+
assert(Array, result.class)
|
85
|
+
assert(0, result.count)
|
86
|
+
result = g.resolved_conversations('zerocracy1', 'baza', 0)
|
87
|
+
assert(Array, result.class)
|
88
|
+
assert(0, result.count)
|
89
|
+
result = g.resolved_conversations('zerocracy', 'baza1', 0)
|
90
|
+
assert(Array, result.class)
|
91
|
+
assert(0, result.count)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_does_not_count_unresolved_conversations
|
95
|
+
skip # it's a "live" test, run it manually if you need it
|
96
|
+
WebMock.allow_net_connect!
|
97
|
+
g = Fbe.github_graph(options: Judges::Options.new, loog: Loog::NULL, global: {})
|
98
|
+
result = g.resolved_conversations('zerocracy', 'judges-action', 296)
|
99
|
+
assert_equal(0, result.count)
|
83
100
|
end
|
84
101
|
|
85
102
|
def test_gets_total_commits_of_repo
|
@@ -91,4 +108,18 @@ class TestGitHubGraph < Minitest::Test
|
|
91
108
|
result = g.total_commits('zerocracy', 'baza', 'master')
|
92
109
|
assert(result.positive?)
|
93
110
|
end
|
111
|
+
|
112
|
+
def test_get_fake_empty_conversations
|
113
|
+
WebMock.disable_net_connect!
|
114
|
+
graph = Fbe.github_graph(options: Judges::Options.new('testing' => true), loog: Loog::NULL, global: {})
|
115
|
+
result = graph.resolved_conversations(nil, 'baza', 172)
|
116
|
+
assert(result.empty?)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_get_fake_conversations
|
120
|
+
WebMock.disable_net_connect!
|
121
|
+
graph = Fbe.github_graph(options: Judges::Options.new('testing' => true), loog: Loog::NULL, global: {})
|
122
|
+
result = graph.resolved_conversations('zerocracy', 'baza', 172)
|
123
|
+
assert_equal(1, result.count)
|
124
|
+
end
|
94
125
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fbe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.59
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|