Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/npm_and_yarn/next-auth-5.0.0-b…
Browse files Browse the repository at this point in the history
…eta.20
  • Loading branch information
simonbs authored Jul 29, 2024
2 parents b23ebfc + b962960 commit 5058207
Show file tree
Hide file tree
Showing 104 changed files with 2,083 additions and 2,462 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ POSTGRESQL_USER=dbuser
POSTGRESQL_PASSWORD=
POSTGRESQL_DB=shape-docs
REPOSITORY_NAME_SUFFIX=-openapi
HIDDEN_REPOSITORIES=
NEW_PROJECT_TEMPLATE_REPOSITORY=shapehq/starter-openapi
GITHUB_WEBHOOK_SECRET=preshared secret also put in app configuration in GitHub
GITHUB_WEBHOK_REPOSITORY_ALLOWLIST=
GITHUB_WEBHOK_REPOSITORY_DISALLOWLIST=
Expand Down
2 changes: 1 addition & 1 deletion __test__/auth/AuthjsAccountsOAuthTokenRepository.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AuthjsAccountsOAuthTokenRepository } from "../../src/features/auth/domain"
import { AuthjsAccountsOAuthTokenRepository } from "@/features/auth/domain"

test("It gets token for user ID and provider", async () => {
let queryUserId: string | undefined
Expand Down
2 changes: 1 addition & 1 deletion __test__/auth/CompositeLogOutHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CompositeLogOutHandler } from "../../src/features/auth/domain"
import { CompositeLogOutHandler } from "@/features/auth/domain"

test("It invokes all log out handlers", async () => {
let didCallLogOutHandler1 = false
Expand Down
2 changes: 1 addition & 1 deletion __test__/auth/ErrorIgnoringLogOutHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ErrorIgnoringLogOutHandler } from "../../src/features/auth/domain"
import { ErrorIgnoringLogOutHandler } from "@/features/auth/domain"

test("It ignores errors", async () => {
const sut = new ErrorIgnoringLogOutHandler({
Expand Down
2 changes: 1 addition & 1 deletion __test__/auth/LockingAccessTokenRefresher.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LockingOAuthTokenRefresher } from "../../src/features/auth/domain"
import { LockingOAuthTokenRefresher } from "@/features/auth/domain"

test("It acquires a lock", async () => {
let didAcquireLock = false
Expand Down
2 changes: 1 addition & 1 deletion __test__/auth/LogInHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LogInHandler } from "../../src/features/auth/domain"
import { LogInHandler } from "@/features/auth/domain"

test("It disallows logging in when account is undefined", async () => {
const sut = new LogInHandler({
Expand Down
2 changes: 1 addition & 1 deletion __test__/auth/OAuthTokenDataSource.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OAuthTokenDataSource } from "../../src/features/auth/domain"
import { OAuthTokenDataSource } from "@/features/auth/domain"

test("It reads OAuth token for user's ID", async () => {
let readUserId: string | undefined
Expand Down
2 changes: 1 addition & 1 deletion __test__/auth/OAuthTokenRepository.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OAuthTokenRepository } from "../../src/features/auth/domain"
import { OAuthTokenRepository } from "@/features/auth/domain"

test("It reads the auth token for the specified user", async () => {
let readProvider: string | undefined
Expand Down
2 changes: 1 addition & 1 deletion __test__/auth/OAuthTokenSessionValidator.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OAuthTokenSessionValidator, SessionValidity } from "../../src/features/auth/domain"
import { OAuthTokenSessionValidator, SessionValidity } from "@/features/auth/domain"

test("It reads the access token", async () => {
let didReadOAuthToken = false
Expand Down
2 changes: 1 addition & 1 deletion __test__/auth/PersistingOAuthTokenRefresher.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PersistingOAuthTokenRefresher, OAuthToken } from "../../src/features/auth/domain"
import { PersistingOAuthTokenRefresher, OAuthToken } from "@/features/auth/domain"

test("It refreshes OAuth token using provided refresh token", async () => {
let usedRefreshToken: string | undefined
Expand Down
2 changes: 1 addition & 1 deletion __test__/auth/UserDataCleanUpLogOutHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserDataCleanUpLogOutHandler } from "../../src/features/auth/domain"
import { UserDataCleanUpLogOutHandler } from "@/features/auth/domain"

test("It deletes data for the read user ID", async () => {
let deletedUserId: string | undefined
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { OAuthTokenRefreshingGitHubClient } from "@/common"
import {
OAuthTokenRefreshingGitHubClient,
GraphQLQueryRequest,
GetRepositoryContentRequest,
GetPullRequestCommentsRequest,
AddCommentToPullRequestRequest
} from "@/common/github/IGitHubClient"
} from "@/common"

test("It forwards a GraphQL request", async () => {
let forwardedRequest: GraphQLQueryRequest | undefined
Expand Down
2 changes: 1 addition & 1 deletion __test__/common/utils/listFromCommaSeparatedString.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import listFromCommaSeparatedString from "@/common/utils/listFromCommaSeparatedString"
import { listFromCommaSeparatedString } from "@/common"

test("It returns an empty list given undefined", async () => {
const result = listFromCommaSeparatedString(undefined)
Expand Down
2 changes: 1 addition & 1 deletion __test__/common/utils/saneParseInt.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import saneParseInt from "@/common/utils/saneParseInt"
import { saneParseInt } from "@/common"

test("It parses an integer", async () => {
// @ts-ignore
Expand Down
2 changes: 1 addition & 1 deletion __test__/hooks/FilteringPullRequestEventHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FilteringPullRequestEventHandler } from "../../src/features/hooks/domain"
import { FilteringPullRequestEventHandler } from "@/features/hooks/domain"

test("It calls pullRequestOpened(_:) when event is included", async () => {
let didCall = false
Expand Down
2 changes: 1 addition & 1 deletion __test__/hooks/PostCommentPullRequestEventHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PostCommentPullRequestEventHandler } from "../../src/features/hooks/domain"
import { PostCommentPullRequestEventHandler } from "@/features/hooks/domain"

test("It comments when opening a pull request", async () => {
let didComment = false
Expand Down
2 changes: 1 addition & 1 deletion __test__/hooks/PullRequestCommenter.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PullRequestCommenter } from "../../src/features/hooks/domain"
import { PullRequestCommenter } from "@/features/hooks/domain"

test("It adds comment when none exist", async () => {
let didAddComment = false
Expand Down
2 changes: 1 addition & 1 deletion __test__/hooks/RepositoryNameEventFilter.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RepositoryNameEventFilter } from "../../src/features/hooks/domain"
import { RepositoryNameEventFilter } from "@/features/hooks/domain"

test("It does not include repositories that do not have the \"-openapi\" suffix", async () => {
const sut = new RepositoryNameEventFilter({
Expand Down
2 changes: 1 addition & 1 deletion __test__/projects/CachingProjectDataSource.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Project, CachingProjectDataSource } from "../../src/features/projects/domain"
import { Project, CachingProjectDataSource } from "@/features/projects/domain"

test("It caches projects read from the data source", async () => {
const projects: Project[] = [{
Expand Down
125 changes: 125 additions & 0 deletions __test__/projects/FilteringGitHubRepositoryDataSource.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import { FilteringGitHubRepositoryDataSource } from "@/features/projects/domain"

test("It returns all repositories when no hidden repositories are provided", async () => {
const sut = new FilteringGitHubRepositoryDataSource({
hiddenRepositories: [],
dataSource: {
async getRepositories() {
return [{
owner: "acme",
name: "foo-openapi",
defaultBranchRef: {
id: "12345678",
name: "main"
},
branches: [],
tags: []
}, {
owner: "acme",
name: "bar-openapi",
defaultBranchRef: {
id: "12345678",
name: "bar"
},
branches: [],
tags: []
}]
}
}
})
const repositories = await sut.getRepositories()
expect(repositories.length).toEqual(2)
})

test("It removes hidden repository", async () => {
const sut = new FilteringGitHubRepositoryDataSource({
hiddenRepositories: ["acme/foo-openapi"],
dataSource: {
async getRepositories() {
return [{
owner: "acme",
name: "foo-openapi",
defaultBranchRef: {
id: "12345678",
name: "main"
},
branches: [],
tags: []
}, {
owner: "acme",
name: "bar-openapi",
defaultBranchRef: {
id: "12345678",
name: "bar"
},
branches: [],
tags: []
}]
}
}
})
const repositories = await sut.getRepositories()
expect(repositories.length).toEqual(1)
})

test("It returns unmodified list when hidden repository was not found", async () => {
const sut = new FilteringGitHubRepositoryDataSource({
hiddenRepositories: ["acme/baz-openapi"],
dataSource: {
async getRepositories() {
return [{
owner: "acme",
name: "foo-openapi",
defaultBranchRef: {
id: "12345678",
name: "main"
},
branches: [],
tags: []
}, {
owner: "acme",
name: "bar-openapi",
defaultBranchRef: {
id: "12345678",
name: "bar"
},
branches: [],
tags: []
}]
}
}
})
const repositories = await sut.getRepositories()
expect(repositories.length).toEqual(2)
})

test("It removes multiple hidden repositories", async () => {
const sut = new FilteringGitHubRepositoryDataSource({
hiddenRepositories: ["acme/foo-openapi", "acme/bar-openapi"],
dataSource: {
async getRepositories() {
return [{
owner: "acme",
name: "foo-openapi",
defaultBranchRef: {
id: "12345678",
name: "main"
},
branches: [],
tags: []
}, {
owner: "acme",
name: "bar-openapi",
defaultBranchRef: {
id: "12345678",
name: "bar"
},
branches: [],
tags: []
}]
}
}
})
const repositories = await sut.getRepositories()
expect(repositories.length).toEqual(0)
})
Loading

0 comments on commit 5058207

Please sign in to comment.