Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit e849c1b

Browse files
committed
Fix failing tests.
1 parent 41338fc commit e849c1b

File tree

7 files changed

+15
-9
lines changed

7 files changed

+15
-9
lines changed

src/GitHub.InlineReviews/ViewModels/PullRequestReviewCommentViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public PullRequestReviewCommentViewModel(
9696
new ActorViewModel(model.Author),
9797
model.CreatedAt,
9898
review.State == PullRequestReviewState.Pending,
99-
new Uri(model.Url))
99+
model.Url != null ? new Uri(model.Url) : null)
100100
{
101101
}
102102

test/GitHub.InlineReviews.UnitTests/Services/PullRequestSessionManagerTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,7 @@ IPullRequestSessionService CreateRealSessionService(
690690
diff,
691691
Substitute.For<IApiClientFactory>(),
692692
Substitute.For<IGraphQLClientFactory>(),
693-
Substitute.For<IUsageTracker>(),
694-
Substitute.For<IAvatarProvider>());
693+
Substitute.For<IUsageTracker>());
695694
result.CreateRebuildSignal().Returns(new Subject<ITextSnapshot>());
696695
result.GetPullRequestMergeBase(
697696
Arg.Any<ILocalRepositoryModel>(),

test/GitHub.InlineReviews.UnitTests/Services/PullRequestSessionTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,8 +763,7 @@ static IPullRequestSessionService CreateRealSessionService(IDiffService diffServ
763763
diffService ?? Substitute.For<IDiffService>(),
764764
Substitute.For<IApiClientFactory>(),
765765
Substitute.For<IGraphQLClientFactory>(),
766-
Substitute.For<IUsageTracker>(),
767-
Substitute.For<IAvatarProvider>());
766+
Substitute.For<IUsageTracker>());
768767

769768
result.GetTipSha(Arg.Any<ILocalRepositoryModel>()).Returns("BRANCH_TIP");
770769
result.GetPullRequestMergeBase(Arg.Any<ILocalRepositoryModel>(), Arg.Any<PullRequestDetailModel>())

test/GitHub.InlineReviews.UnitTests/ViewModels/InlineCommentPeekViewModelTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ InlineCommentModel CreateComment(string body)
302302
Comment = new PullRequestReviewCommentModel
303303
{
304304
Body = body,
305-
}
305+
},
306+
Review = new PullRequestReviewModel(),
306307
};
307308
}
308309

test/GitHub.InlineReviews.UnitTests/ViewModels/InlineCommentThreadViewModelTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ InlineCommentModel CreateComment(string id, string body)
7272
Comment = new PullRequestReviewCommentModel
7373
{
7474
Id = id,
75-
//Author = new ActorModel { Login = "CurrentUser" },
7675
Body = body,
7776
},
77+
Review = new PullRequestReviewModel(),
7878
};
7979
}
8080

test/GitHub.InlineReviews.UnitTests/ViewModels/NewInlineCommentThreadViewModelTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public void CreatesReplyPlaceholder()
2020
false);
2121

2222
Assert.That(target.Comments, Has.One.Items);
23-
Assert.That(string.Empty, Is.EqualTo(target.Comments[0].Body));
24-
Assert.That(CommentEditState.Placeholder, Is.EqualTo(target.Comments[0].EditState));
23+
Assert.That(target.Comments[0].Body, Is.EqualTo(string.Empty));
24+
Assert.That(target.Comments[0].EditState, Is.EqualTo(CommentEditState.Placeholder));
2525
}
2626

2727
[Test]

test/GitHub.InlineReviews.UnitTests/ViewModels/PullRequestReviewCommentViewModelTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Reactive.Linq;
3+
using System.Threading.Tasks;
34
using GitHub.InlineReviews.ViewModels;
45
using GitHub.Models;
56
using GitHub.Services;
@@ -156,6 +157,11 @@ public void IsUpdateCommentWhenEditingExistingComment()
156157

157158
public class TheStartReviewCommand
158159
{
160+
public TheStartReviewCommand()
161+
{
162+
Splat.ModeDetector.Current.SetInUnitTestRunner(true);
163+
}
164+
159165
[Test]
160166
public void IsDisabledWhenSessionHasPendingReview()
161167
{
@@ -240,6 +246,7 @@ static ICommentThreadViewModel CreateThread(
240246
bool canPost = true)
241247
{
242248
var result = Substitute.For<ICommentThreadViewModel>();
249+
result.PostComment.Returns(ReactiveCommand.CreateAsyncTask(_ => Task.CompletedTask));
243250
return result;
244251
}
245252
}

0 commit comments

Comments
 (0)