Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(preview): added preview images #848

Merged
merged 7 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 122 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"@types/express": "^4.17.13",
"@types/express-session": "^1.17.5",
"@types/jest": "^27.4.1",
"@types/jsdom": "^21.1.1",
"@types/lodash": "^4.14.186",
"@types/node": "^17.0.21",
"@types/supertest": "^2.0.11",
Expand Down
10 changes: 10 additions & 0 deletions src/errors/PreviewParsingError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { BaseIsomerError } from "@errors/BaseError"

export default class FaviconParsingError extends BaseIsomerError {
url: string

constructor(url: string, message = "Unable parse favicon from document") {
super({ status: 422, code: "FaviconParsingError", message })
this.url = url
}
}
3 changes: 3 additions & 0 deletions src/integration/NotificationOnEditHandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { UnlinkedPageService } from "@root/services/fileServices/MdPageServices/
import { CollectionYmlService } from "@root/services/fileServices/YmlFileServices/CollectionYmlService"
import { ConfigService } from "@root/services/fileServices/YmlFileServices/ConfigService"
import { FooterYmlService } from "@root/services/fileServices/YmlFileServices/FooterYmlService"
import PreviewService from "@root/services/identity/PreviewService"
import { SitesCacheService } from "@root/services/identity/SitesCacheService"
import { GitHubService } from "@services/db/GitHubService"
import * as ReviewApi from "@services/db/review"
Expand Down Expand Up @@ -125,6 +126,7 @@ const reviewRequestService = new ReviewRequestService(
const MockSitesCacheService = {
getLastUpdated: jest.fn(),
}
const MockPreviewService = {}
const sitesService = new SitesService({
siteRepository: Site,
gitHubService: (mockGithubService as unknown) as GitHubService,
Expand All @@ -133,6 +135,7 @@ const sitesService = new SitesService({
isomerAdminsService: (jest.fn() as unknown) as IsomerAdminsService,
reviewRequestService,
sitesCacheService: (MockSitesCacheService as unknown) as SitesCacheService,
previewService: (MockPreviewService as unknown) as PreviewService,
})
const collaboratorsService = new CollaboratorsService({
siteRepository: Site,
Expand Down
3 changes: 3 additions & 0 deletions src/integration/Notifications.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { ConfigService } from "@root/services/fileServices/YmlFileServices/Confi
import { ConfigYmlService } from "@root/services/fileServices/YmlFileServices/ConfigYmlService"
import { FooterYmlService } from "@root/services/fileServices/YmlFileServices/FooterYmlService"
import CollaboratorsService from "@root/services/identity/CollaboratorsService"
import PreviewService from "@root/services/identity/PreviewService"
import { SitesCacheService } from "@root/services/identity/SitesCacheService"
import SitesService from "@root/services/identity/SitesService"
import ReviewRequestService from "@root/services/review/ReviewRequestService"
Expand Down Expand Up @@ -118,6 +119,7 @@ const reviewRequestService = new ReviewRequestService(
const MockSitesCacheService = {
getLastUpdated: jest.fn(),
}
const MockPreviewService = {}
const sitesService = new SitesService({
siteRepository: Site,
gitHubService,
Expand All @@ -126,6 +128,7 @@ const sitesService = new SitesService({
isomerAdminsService,
reviewRequestService,
sitesCacheService: (MockSitesCacheService as unknown) as SitesCacheService,
previewService: (MockPreviewService as unknown) as PreviewService,
})
const collaboratorsService = new CollaboratorsService({
siteRepository: Site,
Expand Down
3 changes: 3 additions & 0 deletions src/integration/Privatisation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { FooterYmlService } from "@root/services/fileServices/YmlFileServices/Fo
import { NavYmlService } from "@root/services/fileServices/YmlFileServices/NavYmlService"
import CollaboratorsService from "@root/services/identity/CollaboratorsService"
import DeploymentsService from "@root/services/identity/DeploymentsService"
import PreviewService from "@root/services/identity/PreviewService"
import { SitesCacheService } from "@root/services/identity/SitesCacheService"
import AuthorizationMiddlewareService from "@root/services/middlewareServices/AuthorizationMiddlewareService"
import { GitHubService } from "@services/db/GitHubService"
Expand Down Expand Up @@ -147,6 +148,7 @@ const reviewRequestService = new ReviewRequestService(
const MockSitesCacheService = {
getLastUpdated: jest.fn(),
}
const MockPreviewService = {}
const sitesService = new SitesService({
siteRepository: Site,
gitHubService,
Expand All @@ -155,6 +157,7 @@ const sitesService = new SitesService({
isomerAdminsService,
reviewRequestService,
sitesCacheService: (MockSitesCacheService as unknown) as SitesCacheService,
previewService: (MockPreviewService as unknown) as PreviewService,
})
const navYmlService = new NavYmlService({
gitHubService,
Expand Down
3 changes: 3 additions & 0 deletions src/integration/Reviews.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import { UnlinkedPageService } from "@root/services/fileServices/MdPageServices/
import { CollectionYmlService } from "@root/services/fileServices/YmlFileServices/CollectionYmlService"
import { ConfigService } from "@root/services/fileServices/YmlFileServices/ConfigService"
import { FooterYmlService } from "@root/services/fileServices/YmlFileServices/FooterYmlService"
import PreviewService from "@root/services/identity/PreviewService"
import { SitesCacheService } from "@root/services/identity/SitesCacheService"
import { ReviewRequestDto } from "@root/types/dto/review"
import { GitHubService } from "@services/db/GitHubService"
Expand Down Expand Up @@ -150,6 +151,7 @@ const reviewRequestService = new ReviewRequestService(
const MockSitesCacheService = {
getLastUpdated: jest.fn(),
}
const MockPreviewService = {}
const sitesService = new SitesService({
siteRepository: Site,
gitHubService,
Expand All @@ -158,6 +160,7 @@ const sitesService = new SitesService({
isomerAdminsService,
reviewRequestService,
sitesCacheService: (MockSitesCacheService as unknown) as SitesCacheService,
previewService: (MockPreviewService as unknown) as PreviewService,
})
const collaboratorsService = new CollaboratorsService({
siteRepository: Site,
Expand Down
4 changes: 4 additions & 0 deletions src/integration/Sites.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import DeploymentsService from "@root/services/identity/DeploymentsService"
import IsomerAdminsService from "@root/services/identity/IsomerAdminsService"
import LaunchClient from "@root/services/identity/LaunchClient"
import LaunchesService from "@root/services/identity/LaunchesService"
import PreviewService from "@root/services/identity/PreviewService"
import QueueService from "@root/services/identity/QueueService"
import ReposService from "@root/services/identity/ReposService"
import { SitesCacheService } from "@root/services/identity/SitesCacheService"
Expand Down Expand Up @@ -117,6 +118,8 @@ const reviewRequestService = new ReviewRequestService(
const MockSitesCacheService = {
getLastUpdated: jest.fn(),
}

const MockPreviewService = {}
const sitesService = new SitesService({
siteRepository: Site,
gitHubService,
Expand All @@ -125,6 +128,7 @@ const sitesService = new SitesService({
isomerAdminsService,
reviewRequestService,
sitesCacheService: (MockSitesCacheService as unknown) as SitesCacheService,
previewService: (MockPreviewService as unknown) as PreviewService,
})
const collaboratorsService = new CollaboratorsService({
siteRepository: Site,
Expand Down
Loading