Skip to content

Commit

Permalink
try again
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Apr 16, 2024
1 parent 2364b6d commit d6da194
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 29 deletions.
6 changes: 3 additions & 3 deletions fern/apis/revalidation/definition/__package__.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ service:
method: POST
request:
name: CreateRevalidateAllV2Request
headers:
x-fern-host:
headers:
x-fern-host:
type: string
docs: |
The host you want to revalidate the docs for.
Expand All @@ -37,5 +37,5 @@ types:

SuccessfulRevalidations:
properties:
success: string
success: boolean
url: string
32 changes: 25 additions & 7 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion servers/fdr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@aws-sdk/s3-request-presigner": "^3.540.0",
"@fern-api/fdr-sdk": "workspace:*",
"@fern-api/venus-api-sdk": "^0.1.0",
"@fern-fern/revalidation-sdk": "0.0.2",
"@fern-fern/revalidation-sdk": "0.0.7",
"@prisma/client": "5.11.0",
"@slack/web-api": "^6.9.0",
"@ungap/url-search-params": "0.2.2",
Expand Down
17 changes: 0 additions & 17 deletions servers/fdr/src/__test__/ete/ete.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import axios from "axios";
import { RevalidatorServiceImpl } from "../../services/revalidator/RevalidatorService";
import { ParsedBaseUrl } from "../../util/ParsedBaseUrl";

const PORT = 8080;

Expand All @@ -10,18 +8,3 @@ it("definition register", async () => {
const healthResponse = await axios.get(`http://localhost:${PORT}/health`);
expect(healthResponse.status).toEqual(200);
});

it("revalidates a custom docs domain", async () => {
const revalidationService = new RevalidatorServiceImpl();

const revalidationResult = await revalidationService.revalidate({
baseUrl: ParsedBaseUrl.parse("https://fdr-ete-test.buildwithfern.com"),
fernUrl: ParsedBaseUrl.parse("https://fdr-ete-test.buildwithfern.com"),
});

expect(revalidationResult.revalidationFailed).toEqual(false);

expect(revalidationResult.response?.failedRevalidations.length).toEqual(0);

expect(revalidationResult.response?.successfulRevalidations.length).toBeGreaterThan(0);
});
17 changes: 17 additions & 0 deletions servers/fdr/src/__test__/unit-tests/revalidate.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { RevalidatorServiceImpl } from "../../services/revalidator/RevalidatorService";
import { ParsedBaseUrl } from "../../util/ParsedBaseUrl";

it("revalidates a custom docs domain", async () => {
const revalidationService = new RevalidatorServiceImpl();

const revalidationResult = await revalidationService.revalidate({
baseUrl: ParsedBaseUrl.parse("https://fdr-ete-test.buildwithfern.com"),
fernUrl: ParsedBaseUrl.parse("https://fdr-ete-test.buildwithfern.com"),
});

expect(revalidationResult.revalidationFailed).toEqual(false);

expect(revalidationResult.response?.failedRevalidations.length).toEqual(0);

expect(revalidationResult.response?.successfulRevalidations.length).toBeGreaterThan(0);
});
2 changes: 1 addition & 1 deletion servers/fdr/src/services/revalidator/RevalidatorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class RevalidatorServiceImpl implements RevalidatorService {
console.log(baseUrl.path != null ? fernUrl.hostname : baseUrl.hostname);
const response = await client.revalidateAllV2({
host: baseUrl.hostname,
basePath: baseUrl.path != null ? `?basePath=${baseUrl.path}` : "",
basePath: baseUrl.path != null ? baseUrl.path : "",
xFernHost: baseUrl.hostname,
});
return {
Expand Down

0 comments on commit d6da194

Please sign in to comment.