Skip to content

Commit

Permalink
fix type check
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity committed Oct 9, 2024
1 parent 861114f commit a3f5020
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 161 deletions.
2 changes: 2 additions & 0 deletions packages/ui/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
],
"scripts": {
"test": "vitest --run --passWithNoTests --globals --disable-console-intercept",
"compile": "tsc",
"check-types": "tsc --noEmit",
"lint:eslint": "eslint --max-warnings 1000 . --ignore-path=../../../.eslintignore",
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
Expand Down
90 changes: 0 additions & 90 deletions packages/ui/app/src/api-reference/artifacts/ApiArtifacts.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,28 @@
* @vitest-environment jsdom
*/

import { PathPart } from "@fern-api/fdr-sdk/api-definition";
import { EnvironmentId, PropertyKey } from "@fern-api/fdr-sdk/navigation";
import { render, screen } from "@testing-library/react";
import { ResolvedEndpointPathParts } from "../../../resolver/types";
import { EndpointUrl } from "../EndpointUrl";

function lit(value: string): ResolvedEndpointPathParts.Literal {
function lit(value: string): PathPart.Literal {
return { type: "literal", value };
}

function path(key: string): ResolvedEndpointPathParts.PathParameter {
function path(key: string): PathPart.PathParameter {
return {
type: "pathParameter",
key,
valueShape: { type: "primitive", description: undefined, availability: undefined, value: { type: "string" } },
hidden: false,
description: undefined,
availability: undefined,
value: PropertyKey(key),
};
}

describe("EndpointUrl", () => {
it("works with lit and path", async () => {
render(
<EndpointUrl
selectedEnvironment={{
id: "Production",
baseUrl: "https://api.buildwithfern.com",
}}
environmentId={EnvironmentId("Production")}
baseUrl="https://api.buildwithfern.com"
path={[lit("/testing/"), path("id")]}
method={"GET"}
showEnvironment={true}
Expand All @@ -41,10 +36,8 @@ describe("EndpointUrl", () => {
it("renders full environment with basepath", async () => {
render(
<EndpointUrl
selectedEnvironment={{
id: "Production",
baseUrl: "https://api.buildwithfern.com/with/basepath",
}}
environmentId={EnvironmentId("Production")}
baseUrl="https://api.buildwithfern.com/with/basepath"
path={[lit("/testing/"), path("id")]}
method={"GET"}
showEnvironment={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ describe("PlaygroundCodeSnippetBuilder", () => {
{
key: APIV1Read.PropertyKey("test"),
valueShape: {
type: "primitive",
type: "alias",
value: {
type: "string",
regex: undefined,
minLength: undefined,
maxLength: undefined,
default: undefined,
type: "primitive",
value: {
type: "string",
regex: undefined,
minLength: undefined,
maxLength: undefined,
default: undefined,
},
},
},
description: undefined,
Expand Down Expand Up @@ -99,6 +102,7 @@ describe("PlaygroundCodeSnippetBuilder", () => {
endpoint,
auth: undefined,
types: {},
globalHeaders: [],
};

it("should render curl", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/app/src/playground/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function isExpandable(
}

export function hasRequiredFields(
bodyShape: HttpRequestBodyShape | TypeReference,
bodyShape: HttpRequestBodyShape | TypeShapeOrReference,
types: Record<string, TypeDefinition>,
): boolean {
if (bodyShape.type === "formData") {
Expand Down
46 changes: 0 additions & 46 deletions packages/ui/app/src/resolver/url.ts

This file was deleted.

4 changes: 3 additions & 1 deletion packages/ui/app/src/seo/__test__/getBreadcrumbList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ title: Overriden Title
icon: undefined,
hidden: false,
noindex: undefined,
canonicalSlug: undefined,
};
const parents: FernNavigation.NavigationNode[] = [
{
Expand All @@ -34,13 +35,14 @@ title: Overriden Title
children: [node],
overviewPageId: undefined,
pointsTo: undefined,
canonicalSlug: undefined,
},
];
expect(
getBreadcrumbList(
"buildwithfern.com",
{
[node.pageId]: { markdown },
[node.pageId]: { markdown, editThisPageUrl: undefined },
},
parents,
node,
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"composite": true,
"noEmit": false,
"outDir": "./dist",
"rootDir": "."
"rootDir": "./src"
},
"include": ["./src/**/*"],
"references": [
Expand Down
1 change: 1 addition & 0 deletions packages/ui/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
],
"scripts": {
"test": "vitest --run --passWithNoTests --globals --disable-console-intercept",
"compile": "tsc",
"lint:eslint": "eslint --max-warnings 0 . --ignore-path=../../../.eslintignore",
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
Expand Down
3 changes: 3 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"outputs": ["dist/**"],
"dependsOn": ["^compile"]
},
"check-types": {
"dependsOn": ["^compile"]
},
"lint": {},
"lint:eslint": {},
"lint:style": {},
Expand Down

0 comments on commit a3f5020

Please sign in to comment.