Skip to content
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
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default [
{
files: ['**/*.test.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 0,
'no-sparse-arrays': 0
}
}
Expand Down
37 changes: 27 additions & 10 deletions src/__tests__/__snapshots__/docs.local.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,32 @@

exports[`docsLocal should return specific properties 1`] = `
{
"LOCAL_DOCS": [
"[@patternfly/react-charts](/documentation/charts/README.md)",
"[@patternfly/react-chatbot](/documentation/chatbot/README.md)",
"[@patternfly/react-component-groups](/documentation/component-groups/README.md)",
"[@patternfly/react-components](/documentation/components/README.md)",
"[@patternfly/react-guidelines](/documentation/guidelines/README.md)",
"[@patternfly/react-resources](/documentation/resources/README.md)",
"[@patternfly/react-setup](/documentation/setup/README.md)",
"[@patternfly/react-troubleshooting](/documentation/troubleshooting/README.md)",
],
"getLocalDocs": [Function],
}
`;

exports[`getLocalDocs should return local references when called, default 1`] = `
[
"[@patternfly/react-charts](/documentation/charts/README.md)",
"[@patternfly/react-chatbot](/documentation/chatbot/README.md)",
"[@patternfly/react-component-groups](/documentation/component-groups/README.md)",
"[@patternfly/react-components](/documentation/components/README.md)",
"[@patternfly/react-guidelines](/documentation/guidelines/README.md)",
"[@patternfly/react-resources](/documentation/resources/README.md)",
"[@patternfly/react-setup](/documentation/setup/README.md)",
"[@patternfly/react-troubleshooting](/documentation/troubleshooting/README.md)",
]
`;

exports[`getLocalDocs should return local references when called, with custom docsPath 1`] = `
[
"[@patternfly/react-charts](custom/docs/path/charts/README.md)",
"[@patternfly/react-chatbot](custom/docs/path/chatbot/README.md)",
"[@patternfly/react-component-groups](custom/docs/path/component-groups/README.md)",
"[@patternfly/react-components](custom/docs/path/components/README.md)",
"[@patternfly/react-guidelines](custom/docs/path/guidelines/README.md)",
"[@patternfly/react-resources](custom/docs/path/resources/README.md)",
"[@patternfly/react-setup](custom/docs/path/setup/README.md)",
"[@patternfly/react-troubleshooting](custom/docs/path/troubleshooting/README.md)",
]
`;
73 changes: 73 additions & 0 deletions src/__tests__/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`main should merge default, cli and programmatic options, merge programmatic options with CLI options 1`] = `
{
"calls": [
[
{
"docsHost": true,
},
],
],
"methodRegistersAs": "main",
"sequence": [
"parse",
"set",
"run",
],
}
`;

exports[`main should merge default, cli and programmatic options, merge programmatic options with CLI options, with start alias 1`] = `
{
"calls": [
[
{
"docsHost": true,
},
],
],
"methodRegistersAs": "main",
"sequence": [
"parse",
"set",
"run",
],
}
`;

exports[`main should merge default, cli and programmatic options, with empty programmatic options 1`] = `
{
"calls": [
[
{
"docsHost": true,
},
],
],
"methodRegistersAs": "main",
"sequence": [
"parse",
"set",
"run",
],
}
`;

exports[`main should merge default, cli and programmatic options, with undefined programmatic options 1`] = `
{
"calls": [
[
{
"docsHost": false,
},
],
],
"methodRegistersAs": "main",
"sequence": [
"parse",
"set",
"run",
],
}
`;
11 changes: 11 additions & 0 deletions src/__tests__/__snapshots__/options.context.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`apply context options should set and get basic options, confirm by applying a potential property outside of typings 1`] = `"lorem = ipsum"`;

exports[`apply context options should set and get basic options, default 1`] = `"docsHost = true"`;

exports[`apply context options should set and get basic options, multiple property updates 1`] = `"name = ipsum"`;

exports[`apply context options should set and get basic options, multiple property updates 2`] = `"name = dolor sit amet"`;

exports[`apply context options should set and get basic options, multiple property updates 3`] = `"name = consectetur adipiscing elit"`;
176 changes: 176 additions & 0 deletions src/__tests__/__snapshots__/options.defaults.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`options defaults should return specific properties 1`] = `
{
"DEFAULTS": {
"DEFAULT_OPTIONS": {
"contextPath": "/",
"docsPath": "/documentation",
"llmsFilesPath": "/llms-files",
"name": "@patternfly/patternfly-mcp",
"pfExternal": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content",
"pfExternalAccessibility": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/accessibility",
"pfExternalCharts": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src",
"pfExternalChartsComponents": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src/victory/components",
"pfExternalChartsDesign": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src/charts",
"pfExternalDesign": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines",
"pfExternalDesignComponents": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines/components",
"pfExternalDesignLayouts": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines/layouts",
"repoName": "patternfly-mcp",
"resourceMemoOptions": {
"fetchUrl": {
"cacheErrors": false,
"cacheLimit": 100,
"expire": 180000,
},
"readFile": {
"cacheErrors": false,
"cacheLimit": 50,
"expire": 120000,
},
},
"separator": "

---

",
"toolMemoOptions": {
"fetchDocs": {
"cacheErrors": false,
"cacheLimit": 15,
"expire": 60000,
},
"usePatternFlyDocs": {
"cacheErrors": false,
"cacheLimit": 10,
"expire": 60000,
},
},
"urlRegex": /\\^\\(https\\?:\\)\\\\/\\\\//i,
"version": "0.0.0",
},
"DEFAULT_SEPARATOR": "

---

",
"PF_EXTERNAL": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content",
"PF_EXTERNAL_ACCESSIBILITY": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/accessibility",
"PF_EXTERNAL_CHARTS": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src",
"PF_EXTERNAL_CHARTS_COMPONENTS": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src/victory/components",
"PF_EXTERNAL_CHARTS_DESIGN": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src/charts",
"PF_EXTERNAL_DESIGN": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines",
"PF_EXTERNAL_DESIGN_COMPONENTS": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines/components",
"PF_EXTERNAL_DESIGN_LAYOUTS": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines/layouts",
"RESOURCE_MEMO_OPTIONS": {
"fetchUrl": {
"cacheErrors": false,
"cacheLimit": 100,
"expire": 180000,
},
"readFile": {
"cacheErrors": false,
"cacheLimit": 50,
"expire": 120000,
},
},
"TOOL_MEMO_OPTIONS": {
"fetchDocs": {
"cacheErrors": false,
"cacheLimit": 15,
"expire": 60000,
},
"usePatternFlyDocs": {
"cacheErrors": false,
"cacheLimit": 10,
"expire": 60000,
},
},
"URL_REGEX": /\\^\\(https\\?:\\)\\\\/\\\\//i,
},
"DEFAULT_OPTIONS": {
"contextPath": "/",
"docsPath": "/documentation",
"llmsFilesPath": "/llms-files",
"name": "@patternfly/patternfly-mcp",
"pfExternal": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content",
"pfExternalAccessibility": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/accessibility",
"pfExternalCharts": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src",
"pfExternalChartsComponents": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src/victory/components",
"pfExternalChartsDesign": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src/charts",
"pfExternalDesign": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines",
"pfExternalDesignComponents": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines/components",
"pfExternalDesignLayouts": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines/layouts",
"repoName": "patternfly-mcp",
"resourceMemoOptions": {
"fetchUrl": {
"cacheErrors": false,
"cacheLimit": 100,
"expire": 180000,
},
"readFile": {
"cacheErrors": false,
"cacheLimit": 50,
"expire": 120000,
},
},
"separator": "

---

",
"toolMemoOptions": {
"fetchDocs": {
"cacheErrors": false,
"cacheLimit": 15,
"expire": 60000,
},
"usePatternFlyDocs": {
"cacheErrors": false,
"cacheLimit": 10,
"expire": 60000,
},
},
"urlRegex": /\\^\\(https\\?:\\)\\\\/\\\\//i,
"version": "0.0.0",
},
"DEFAULT_SEPARATOR": "

---

",
"PF_EXTERNAL": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content",
"PF_EXTERNAL_ACCESSIBILITY": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/accessibility",
"PF_EXTERNAL_CHARTS": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src",
"PF_EXTERNAL_CHARTS_COMPONENTS": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src/victory/components",
"PF_EXTERNAL_CHARTS_DESIGN": "https://raw.githubusercontent.com/patternfly/patternfly-react/refs/heads/main/packages/react-charts/src/charts",
"PF_EXTERNAL_DESIGN": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines",
"PF_EXTERNAL_DESIGN_COMPONENTS": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines/components",
"PF_EXTERNAL_DESIGN_LAYOUTS": "https://raw.githubusercontent.com/patternfly/patternfly-org/refs/heads/main/packages/documentation-site/patternfly-docs/content/design-guidelines/layouts",
"RESOURCE_MEMO_OPTIONS": {
"fetchUrl": {
"cacheErrors": false,
"cacheLimit": 100,
"expire": 180000,
},
"readFile": {
"cacheErrors": false,
"cacheLimit": 50,
"expire": 120000,
},
},
"TOOL_MEMO_OPTIONS": {
"fetchDocs": {
"cacheErrors": false,
"cacheLimit": 15,
"expire": 60000,
},
"usePatternFlyDocs": {
"cacheErrors": false,
"cacheLimit": 10,
"expire": 60000,
},
},
"URL_REGEX": /\\^\\(https\\?:\\)\\\\/\\\\//i,
}
`;
Loading
Loading