-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 𧱠Init turbo-repo * ποΈ Init turbo-repo * π ignore node_modules in packages/ui
- Loading branch information
1 parent
d7f4bdc
commit 205f56e
Showing
937 changed files
with
19,288 additions
and
16,650 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
/.yarn | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env* | ||
!.env*.example | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
|
||
.turbo |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
101 changes: 101 additions & 0 deletions
101
apps/website/__tests__/components/component-categories.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { SectionsList } from "@cuicui/ui"; | ||
import { getFileContentAsString } from "#/src/utils/get-file-content-as-string"; | ||
|
||
describe("SectionsList", () => { | ||
it("should have the correct number of sections", () => { | ||
expect(SectionsList).toHaveLength(7); | ||
}); | ||
|
||
it("should have the correct section slugs in the good order", () => { | ||
const sectionSlugs = SectionsList.map((section) => section.slug); | ||
expect(sectionSlugs).toEqual([ | ||
"common-ui", | ||
"application-ui", | ||
"marketing-ui", | ||
"other", | ||
"hooks", | ||
"utils", | ||
"tools", | ||
]); | ||
}); | ||
|
||
it("category should have componentList === null if comingSoonCategory === true", () => { | ||
for (const section of SectionsList) { | ||
if (section.type !== "multiple-component") { | ||
continue; | ||
} | ||
//TODO: Handle the single-component test | ||
for (const category of section.categoriesList) { | ||
if (category.comingSoonCategory) { | ||
expect(category.componentList).toBeNull(); | ||
expect(category.componentList).not.toBeUndefined(); | ||
} | ||
} | ||
} | ||
}); | ||
|
||
it("should not return error when reading the file code", async () => { | ||
const testComponentCode = async ( | ||
slug: string, | ||
variantName: string, | ||
shouldError: boolean, | ||
) => { | ||
const code = await getFileContentAsString({ | ||
componentSlug: slug, | ||
variantName, | ||
}); | ||
const errorMessage = `Failed for component slug: ${slug}, variant: ${variantName}`; | ||
// Get first 2 words of the code | ||
const firstTwoWords = code.split(" ").slice(0, 2).join(" "); | ||
if (shouldError) { | ||
expect(firstTwoWords, errorMessage).toEqual("An error"); | ||
} else { | ||
expect(firstTwoWords, errorMessage).not.toEqual("An error"); | ||
} | ||
}; | ||
|
||
for (const section of SectionsList) { | ||
if (section.type !== "multiple-component") { | ||
continue; | ||
} | ||
for (const category of section.categoriesList) { | ||
if (category.componentList) { | ||
for (const component of category.componentList) { | ||
for (const variant of component.variantList) { | ||
// Test without error | ||
await testComponentCode( | ||
category.slug, | ||
`${component.slug}/${variant.slugPreviewFile}`, | ||
false, | ||
); | ||
|
||
if (variant.slugComponentFile) { | ||
await testComponentCode( | ||
category.slug, | ||
`${component.slug}/${variant.slugComponentFile}`, | ||
false, | ||
); | ||
} | ||
|
||
// Test with forced error | ||
await testComponentCode( | ||
category.slug, | ||
`${component.slug}/${variant.slugPreviewFile}error`, | ||
true, | ||
); | ||
|
||
if (variant.slugComponentFile) { | ||
await testComponentCode( | ||
category.slug, | ||
`${component.slug}/${variant.slugComponentFile}error`, | ||
true, | ||
); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.