Skip to content

Commit 3ded925

Browse files
simonbsulrikandersen
authored andcommitted
Revert "Fixes unit tests"
This reverts commit 48c6a59.
1 parent 33c07cf commit 3ded925

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed

__test__/hooks/FilteringPullRequestEventHandler.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ test("It calls pullRequestOpened(_:) when event is included", async () => {
1717
}
1818
})
1919
await sut.pullRequestOpened({
20-
hostURL: "https://localhost:3000",
2120
appInstallationId: 1234,
2221
pullRequestNumber: 42,
2322
repositoryName: "demo-openapi",
@@ -44,7 +43,6 @@ test("It calls pullRequestReopened(_:) when event is included", async () => {
4443
}
4544
})
4645
await sut.pullRequestReopened({
47-
hostURL: "https://localhost:3000",
4846
appInstallationId: 1234,
4947
pullRequestNumber: 42,
5048
repositoryName: "demo-openapi",
@@ -71,7 +69,6 @@ test("It calls pullRequestSynchronized(_:) when event is included", async () =>
7169
}
7270
})
7371
await sut.pullRequestSynchronized({
74-
hostURL: "https://localhost:3000",
7572
appInstallationId: 1234,
7673
pullRequestNumber: 42,
7774
repositoryName: "demo-openapi",
@@ -98,7 +95,6 @@ test("It skips calling pullRequestOpened(_:) when event is not included", async
9895
}
9996
})
10097
await sut.pullRequestOpened({
101-
hostURL: "https://localhost:3000",
10298
appInstallationId: 1234,
10399
pullRequestNumber: 42,
104100
repositoryName: "demo-openapi",
@@ -125,7 +121,6 @@ test("It skips calling pullRequestReopened(_:) when event is not included", asyn
125121
}
126122
})
127123
await sut.pullRequestReopened({
128-
hostURL: "https://localhost:3000",
129124
appInstallationId: 1234,
130125
pullRequestNumber: 42,
131126
repositoryName: "demo-openapi",
@@ -152,7 +147,6 @@ test("It skips calling pullRequestSynchronized(_:) when event is not included",
152147
}
153148
})
154149
await sut.pullRequestSynchronized({
155-
hostURL: "https://localhost:3000",
156150
appInstallationId: 1234,
157151
pullRequestNumber: 42,
158152
repositoryName: "demo-openapi",

__test__/hooks/PostCommentPullRequestEventHandler.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ test("It comments when opening a pull request", async () => {
1010
}
1111
})
1212
await sut.pullRequestOpened({
13-
hostURL: "https://localhost:3000",
1413
appInstallationId: 1234,
1514
pullRequestNumber: 42,
1615
repositoryOwner: "acme",
@@ -30,7 +29,6 @@ test("It comments when reopening a pull request", async () => {
3029
}
3130
})
3231
await sut.pullRequestReopened({
33-
hostURL: "https://localhost:3000",
3432
appInstallationId: 1234,
3533
pullRequestNumber: 42,
3634
repositoryOwner: "acme",
@@ -50,7 +48,6 @@ test("It comments when synchronizing a pull request", async () => {
5048
}
5149
})
5250
await sut.pullRequestSynchronized({
53-
hostURL: "https://localhost:3000",
5451
appInstallationId: 1234,
5552
pullRequestNumber: 42,
5653
repositoryOwner: "acme",

__test__/hooks/PullRequestCommenter.test.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { PullRequestCommenter } from "@/features/hooks/domain"
33
test("It adds comment when none exist", async () => {
44
let didAddComment = false
55
const sut = new PullRequestCommenter({
6+
domain: "https://example.com",
67
siteName: "Demo Docs",
78
repositoryNameSuffix: "-openapi",
89
projectConfigurationFilename: ".demo-docs.yml",
@@ -30,7 +31,6 @@ test("It adds comment when none exist", async () => {
3031
}
3132
})
3233
await sut.commentPullRequest({
33-
hostURL: "https://localhost:3000",
3434
appInstallationId: 1234,
3535
pullRequestNumber: 42,
3636
repositoryOwner: "acme",
@@ -44,6 +44,7 @@ test("It adds comment containing list of changed files", async () => {
4444
let didAddComment = false
4545
let commentBody: string | undefined
4646
const sut = new PullRequestCommenter({
47+
domain: "https://example.com",
4748
siteName: "Demo Docs",
4849
repositoryNameSuffix: "-openapi",
4950
projectConfigurationFilename: ".demo-docs.yml",
@@ -75,7 +76,6 @@ test("It adds comment containing list of changed files", async () => {
7576
}
7677
})
7778
await sut.commentPullRequest({
78-
hostURL: "https://localhost:3000",
7979
appInstallationId: 1234,
8080
pullRequestNumber: 42,
8181
repositoryOwner: "acme",
@@ -91,6 +91,7 @@ test("It adds comment containing list of changed files", async () => {
9191
test("It skips adding comment when no YAML files were found in the PR", async () => {
9292
let didAddComment = false
9393
const sut = new PullRequestCommenter({
94+
domain: "https://example.com",
9495
siteName: "Demo Docs",
9596
repositoryNameSuffix: "-openapi",
9697
projectConfigurationFilename: ".demo-docs.yml",
@@ -118,7 +119,6 @@ test("It skips adding comment when no YAML files were found in the PR", async ()
118119
}
119120
})
120121
await sut.commentPullRequest({
121-
hostURL: "https://localhost:3000",
122122
appInstallationId: 1234,
123123
pullRequestNumber: 42,
124124
repositoryOwner: "acme",
@@ -131,6 +131,7 @@ test("It skips adding comment when no YAML files were found in the PR", async ()
131131
test("It updates comment when one already exists", async () => {
132132
let didUpdateComment = false
133133
const sut = new PullRequestCommenter({
134+
domain: "https://example.com",
134135
siteName: "Demo Docs",
135136
repositoryNameSuffix: "-openapi",
136137
projectConfigurationFilename: ".demo-docs.yml",
@@ -165,7 +166,6 @@ test("It updates comment when one already exists", async () => {
165166
}
166167
})
167168
await sut.commentPullRequest({
168-
hostURL: "https://localhost:3000",
169169
appInstallationId: 1234,
170170
pullRequestNumber: 42,
171171
repositoryOwner: "acme",
@@ -179,6 +179,7 @@ test("It skips updating comment when the body has not changed", async () => {
179179
let addedCommentBody: string | undefined
180180
let didUpdateComment = false
181181
const sut = new PullRequestCommenter({
182+
domain: "https://example.com",
182183
siteName: "Demo Docs",
183184
repositoryNameSuffix: "-openapi",
184185
projectConfigurationFilename: ".demo-docs.yml",
@@ -219,7 +220,6 @@ test("It skips updating comment when the body has not changed", async () => {
219220
})
220221
// Add a comment.
221222
await sut.commentPullRequest({
222-
hostURL: "https://localhost:3000",
223223
appInstallationId: 1234,
224224
pullRequestNumber: 42,
225225
repositoryOwner: "acme",
@@ -228,7 +228,6 @@ test("It skips updating comment when the body has not changed", async () => {
228228
})
229229
// Attempt to update a comment. This is skipped because the body has not changed.
230230
await sut.commentPullRequest({
231-
hostURL: "https://localhost:3000",
232231
appInstallationId: 1234,
233232
pullRequestNumber: 42,
234233
repositoryOwner: "acme",
@@ -245,6 +244,7 @@ test("It updates comment to remove file list when all relevant file changes were
245244
let addedCommentBody: string | undefined
246245
let updatedCommentBody: string | undefined
247246
const sut = new PullRequestCommenter({
247+
domain: "https://example.com",
248248
siteName: "Demo Docs",
249249
repositoryNameSuffix: "-openapi",
250250
projectConfigurationFilename: ".demo-docs.yml",
@@ -292,7 +292,6 @@ test("It updates comment to remove file list when all relevant file changes were
292292
})
293293
// Add a comment.
294294
await sut.commentPullRequest({
295-
hostURL: "https://localhost:3000",
296295
appInstallationId: 1234,
297296
pullRequestNumber: 42,
298297
repositoryOwner: "acme",
@@ -301,7 +300,6 @@ test("It updates comment to remove file list when all relevant file changes were
301300
})
302301
// Attempt to update a comment. This is skipped because the body has not changed.
303302
await sut.commentPullRequest({
304-
hostURL: "https://localhost:3000",
305303
appInstallationId: 1234,
306304
pullRequestNumber: 42,
307305
repositoryOwner: "acme",
@@ -320,6 +318,7 @@ test("It adds comment if only project configuration was edited", async () => {
320318
let didAddComment = false
321319
let commentBody: string | undefined
322320
const sut = new PullRequestCommenter({
321+
domain: "https://example.com",
323322
siteName: "Demo Docs",
324323
repositoryNameSuffix: "-openapi",
325324
projectConfigurationFilename: ".demo-docs.yml",
@@ -358,7 +357,6 @@ test("It adds comment if only project configuration was edited", async () => {
358357
}
359358
})
360359
await sut.commentPullRequest({
361-
hostURL: "https://localhost:3000",
362360
appInstallationId: 1234,
363361
pullRequestNumber: 42,
364362
repositoryOwner: "acme",
@@ -374,6 +372,7 @@ test("It ignores files starting with a dot", async () => {
374372
let didAddComment = false
375373
let commentBody: string | undefined
376374
const sut = new PullRequestCommenter({
375+
domain: "https://example.com",
377376
siteName: "Demo Docs",
378377
repositoryNameSuffix: "-openapi",
379378
projectConfigurationFilename: ".demo-docs.yml",
@@ -405,7 +404,6 @@ test("It ignores files starting with a dot", async () => {
405404
}
406405
})
407406
await sut.commentPullRequest({
408-
hostURL: "https://localhost:3000",
409407
appInstallationId: 1234,
410408
pullRequestNumber: 42,
411409
repositoryOwner: "acme",
@@ -422,6 +420,7 @@ test("It ignores files in directories", async () => {
422420
let didAddComment = false
423421
let commentBody: string | undefined
424422
const sut = new PullRequestCommenter({
423+
domain: "https://example.com",
425424
siteName: "Demo Docs",
426425
repositoryNameSuffix: "-openapi",
427426
projectConfigurationFilename: ".demo-docs.yml",
@@ -453,7 +452,6 @@ test("It ignores files in directories", async () => {
453452
}
454453
})
455454
await sut.commentPullRequest({
456-
hostURL: "https://localhost:3000",
457455
appInstallationId: 1234,
458456
pullRequestNumber: 42,
459457
repositoryOwner: "acme",
@@ -469,6 +467,7 @@ test("It ignores files in directories", async () => {
469467
test("It does not post comment if changes only include ignored filenames", async () => {
470468
let didAddComment = false
471469
const sut = new PullRequestCommenter({
470+
domain: "https://example.com",
472471
siteName: "Demo Docs",
473472
repositoryNameSuffix: "-openapi",
474473
projectConfigurationFilename: ".demo-docs.yml",
@@ -499,7 +498,6 @@ test("It does not post comment if changes only include ignored filenames", async
499498
}
500499
})
501500
await sut.commentPullRequest({
502-
hostURL: "https://localhost:3000",
503501
appInstallationId: 1234,
504502
pullRequestNumber: 42,
505503
repositoryOwner: "acme",

0 commit comments

Comments
 (0)