-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In order to improve readability in our code, magic numbers are now forbidden by the linter. Current errors are fixed. Many are just ignored and have to be fixed successively. Signed-off-by: Benedikt Richter <[email protected]>
- Loading branch information
1 parent
a544d0c
commit 54962ee
Showing
36 changed files
with
168 additions
and
51 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 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 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// SPDX-FileCopyrightText: Nico Carl <[email protected]> | ||
// SPDX-FileCopyrightText: Meta Platforms, Inc. and its affiliates | ||
// SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com> | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
@@ -83,7 +85,11 @@ export function PackageSearchPopup(): ReactElement { | |
const [currentSearchTerm, setCurrentSearchTerm] = useState<string>( | ||
getInitialSearchTerm(temporaryPackageInfo) | ||
); | ||
const debouncedSearchTerm = useDebounceInput(currentSearchTerm, 500); | ||
const debounceDelayInMs = 500; | ||
const debouncedSearchTerm = useDebounceInput( | ||
currentSearchTerm, | ||
debounceDelayInMs | ||
); | ||
const { isLoading, data, isError, error } = useQuery( | ||
['clearlyDefinedPackageSearch', debouncedSearchTerm], | ||
() => searchPackagesOnClearlyDefined(debouncedSearchTerm), | ||
|
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
// SPDX-FileCopyrightText: Nico Carl <[email protected]> | ||
// SPDX-FileCopyrightText: Meta Platforms, Inc. and its affiliates | ||
// SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com> | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
@@ -23,9 +25,11 @@ describe('ClearlyDefinedPackageCard', () => { | |
}); | ||
const testCoordinate = 'sqlalchemy'; | ||
const definitionEndpoint = `https://api.clearlydefined.io/definitions/${testCoordinate}`; | ||
const okStatus = 200; | ||
const notFoundStatus = 404; | ||
|
||
it('renders after successful fetch', async () => { | ||
axiosMock.onGet(definitionEndpoint).replyOnce(200, { | ||
axiosMock.onGet(definitionEndpoint).replyOnce(okStatus, { | ||
licensed: { | ||
declared: 'MIT', | ||
facets: { | ||
|
@@ -82,7 +86,7 @@ describe('ClearlyDefinedPackageCard', () => { | |
it('shows error message when fetch fails', async () => { | ||
// suppress output to console | ||
jest.spyOn(console, 'error').mockImplementation(() => {}); | ||
axiosMock.onGet(definitionEndpoint).replyOnce(404); | ||
axiosMock.onGet(definitionEndpoint).replyOnce(notFoundStatus); | ||
|
||
renderComponentWithStore( | ||
<QueryClientProvider client={queryClient}> | ||
|
Oops, something went wrong.