Skip to content

Commit

Permalink
chore: remove redundant npm registry config (#3855)
Browse files Browse the repository at this point in the history
* remove redundant npm registry config

Signed-off-by: ac892247 <[email protected]>

* return undici to make tests more stable

Signed-off-by: ac892247 <[email protected]>

* remove undici, replace flaky test

Signed-off-by: ac892247 <[email protected]>

---------

Signed-off-by: ac892247 <[email protected]>
  • Loading branch information
achmelo authored Oct 17, 2024
1 parent 58735d6 commit 71a3e53
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
7 changes: 3 additions & 4 deletions api-catalog-ui/frontend/package-lock.json

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

27 changes: 10 additions & 17 deletions api-catalog-ui/frontend/src/components/GraphQL/GraphQLUI.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getIntrospectionQuery } from 'graphql/utilities';
import { render, screen, waitFor, act } from '@testing-library/react';
import '@testing-library/jest-dom';
import GraphQLUI from './GraphQLUIApiml';

import { getUrl } from './GraphQLUIApiml';
const host = 'localhost:3000';
const protocol = 'https:';
const graphqlUrl = 'https://localhost:4000/discoverableclient/api/v3/graphql';
Expand Down Expand Up @@ -91,22 +91,15 @@ describe('>>> GraphQL component tests', () => {
}, 10000);

it('getUrl constructs the correct URL', async () => {
mockFetcher();
render(<GraphQLUI graphqlUrl={graphqlUrl} />);
await waitFor(() => expect(fetch).toHaveBeenCalled());

expect(fetch).toHaveBeenCalledWith(
`${protocol}//${host}/discoverableclient/api/v3/graphql`,
expect.objectContaining({
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: expect.any(String),
credentials: 'same-origin',
})
);
const originalLocation = window.location;
window.location = {
protocol: 'https:',
host: 'example.com',
};
const graphqlUrl = 'https://some-api.com/graphql';
const result = getUrl(graphqlUrl);
expect(result).toBe('https://example.com/graphql');
window.location = originalLocation;
});

it('Fetches and sets schema on mount', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { buildClientSchema, getIntrospectionQuery } from 'graphql/utilities';
* @param {string} graphqlUrl - The GraphQL endpoint URL.
* @returns {string} The full URL for the GraphQL endpoint.
*/
function getUrl(graphqlUrl) {
export function getUrl(graphqlUrl) {
const location = `${window.location.protocol}//${window.location.host}`;
const urlForPathName = new URL(graphqlUrl);
const pathName = urlForPathName.pathname;
Expand Down
2 changes: 0 additions & 2 deletions zowe-cli-id-federation-plugin/.npmrc

This file was deleted.

0 comments on commit 71a3e53

Please sign in to comment.