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

fix(staging links): fix failing staging links #709

Merged
merged 2 commits into from
Apr 13, 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
3 changes: 2 additions & 1 deletion src/routes/v2/authenticated/__tests__/Sites.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import express from "express"
import { ok } from "neverthrow"
import request from "supertest"

import type { AuthorizationMiddleware } from "@middleware/authorization"
Expand Down Expand Up @@ -91,7 +92,7 @@ describe("Sites Router", () => {
describe("getStagingUrl", () => {
it("returns the site's staging URL", async () => {
const stagingUrl = "staging-url"
mockSitesService.getStagingUrl.mockResolvedValueOnce(stagingUrl)
mockSitesService.getStagingUrl.mockResolvedValueOnce(ok(stagingUrl))

const resp = await request(app)
.get(`/${mockSiteName}/stagingUrl`)
Expand Down
6 changes: 3 additions & 3 deletions src/routes/v2/authenticated/sites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ export class SitesRouter {
)

// Check for error and throw
if (possibleStagingUrl instanceof BaseIsomerError) {
return res.status(404).json({ message: possibleStagingUrl.message })
if (possibleStagingUrl.isErr()) {
return res.status(404).json({ message: possibleStagingUrl.error.message })
}
return res.status(200).json({ stagingUrl: possibleStagingUrl })
return res.status(200).json({ stagingUrl: possibleStagingUrl.value })
}

getSiteUrl: RequestHandler<
Expand Down