Skip to content

Commit

Permalink
Add test for getStaticTypes (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
askoufis authored Dec 10, 2024
1 parent fab7863 commit c485242
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 16 deletions.
2 changes: 2 additions & 0 deletions lib/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.test.*

30 changes: 30 additions & 0 deletions lib/getStaticTypes.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// @ts-expect-error No types
import getStaticTypes from './getStaticTypes';
import { resolve } from 'node:path';

describe('getStaticTypes', () => {
it('should get static types from typescript components', async () => {
const result = await getStaticTypes({
cwd: resolve(__dirname, '../cypress/projects/typescript'),
});

expect(result).toMatchInlineSnapshot(`
{
"Bar": {
"color": [
"red",
"blue",
"black",
],
},
"Foo": {
"color": [
"red",
"blue",
"black",
],
},
}
`);
});
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"format": "prettier --write '**/*.{js,md,ts,tsx}'",
"version": "changeset version",
"release": "changeset publish",
"test": "jest src",
"test": "jest src lib",
"post-commit-status": "node scripts/postCommitStatus.js",
"deploy-preview": "surge -p ./cypress/projects/themed/dist"
},
Expand Down Expand Up @@ -125,6 +125,7 @@
"@octokit/rest": "^19.0.5",
"@testing-library/cypress": "^10.0.1",
"@types/jest": "^29.2.4",
"@types/node": "^18.11.9",
"@types/react-helmet": "^6.1.6",
"@types/react-transition-group": "^4.4.10",
"concurrently": "^7.6.0",
Expand Down
32 changes: 18 additions & 14 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 tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"lib": ["dom", "es2022"],
"target": "es2022"
},
"include": ["src"],
"include": ["src", "lib"],
"exclude": ["cypress", "node_modules"]
}

0 comments on commit c485242

Please sign in to comment.