-
Notifications
You must be signed in to change notification settings - Fork 74
refactor(web): use queries for dealing with software #1483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
74654d4
feat(web): Use queries for patterns selection
dgdavid 6d763b7
refactor(web): migrate software queries to TypeScript
dgdavid 8df2c4d
refactor(web): add useProposalChanges hook
dgdavid 479395d
fix(web): export SelectedBy enum
dgdavid 30ed16c
fix(web): export all software types
dgdavid a7d1f5a
chore(web): update @testing-library/jest-dom
dgdavid cc16b83
refactor(web) Migrate components/software to TypeScript
dgdavid aa457fa
fix(web): use same queryClient at software queries
dgdavid b348db0
refactor(web): change how types are exported
dgdavid 5f9bd2e
refactor(web): improve typing in software components
dgdavid 1896c03
fix(web): add esModuleInterop to tsconfig
dgdavid 5f484e1
fix(web): more tsconfig adjustments
dgdavid 9de8dc3
fix(web) bring back software tests
dgdavid c394a05
fix(web) move registration types to their own file
dgdavid 3706d25
fix(web) drop ActionResult type from software.ts
dgdavid ac594f7
fix(web): move internal type
dgdavid 03e024e
refactor(web) adapt overview SoftwareSection to queries
dgdavid 9e037c5
refactor(web) move overview SoftwareSection to TypeScript
dgdavid 04c5d36
fix(web) improve software config mutation
dgdavid e7c4c82
fix(web) updates from code review
dgdavid f69c3ef
fix(web) do not test query changes from component
dgdavid 3d320e3
fix(web) drop dead code in software client
dgdavid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 contains hidden or 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,68 @@ | ||
| /* | ||
| * Copyright (c) [2024] SUSE LLC | ||
| * | ||
| * All Rights Reserved. | ||
| * | ||
| * This program is free software; you can redistribute it and/or modify it | ||
| * under the terms of version 2 of the GNU General Public License as published | ||
| * by the Free Software Foundation. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, but WITHOUT | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| * more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License along | ||
| * with this program; if not, contact SUSE LLC. | ||
| * | ||
| * To contact SUSE LLC about this file by physical or electronic mail, you may | ||
| * find current contact information at www.suse.com. | ||
| */ | ||
|
|
||
| import React from "react"; | ||
| import { act, screen } from "@testing-library/react"; | ||
| import { installerRender } from "~/test-utils"; | ||
| import mockTestingPatterns from "~/components/software/patterns.test.json"; | ||
| import testingProposal from "~/components/software/proposal.test.json"; | ||
| import SoftwareSection from "~/components/overview/SoftwareSection"; | ||
| import { SoftwareProposal } from "~/types/software"; | ||
|
|
||
| let mockTestingProposal: SoftwareProposal; | ||
|
|
||
| jest.mock("~/queries/software", () => ({ | ||
| usePatterns: () => mockTestingPatterns, | ||
| useProposal: () => mockTestingProposal, | ||
| useProposalChanges: jest.fn(), | ||
| })); | ||
|
|
||
| describe("SoftwareSection", () => { | ||
| describe("when the proposal does not have patterns to select", () => { | ||
| beforeEach(() => { | ||
| mockTestingProposal = { patterns: {}, size: "" }; | ||
| }); | ||
|
|
||
| it("renders nothing", () => { | ||
| const { container } = installerRender(<SoftwareSection />); | ||
| expect(container).toBeEmptyDOMElement(); | ||
| }); | ||
| }); | ||
|
|
||
| describe("when the proposal has patterns to select", () => { | ||
| beforeEach(() => { | ||
| mockTestingProposal = testingProposal; | ||
| }); | ||
|
|
||
| it("renders the required space and the selected patterns", () => { | ||
| installerRender(<SoftwareSection />); | ||
| screen.getByText("4.6 GiB"); | ||
| screen.getAllByText(/GNOME/); | ||
| screen.getByText("YaST Base Utilities"); | ||
| screen.getByText("YaST Desktop Utilities"); | ||
| screen.getByText("Multimedia"); | ||
| screen.getAllByText(/Office Software/); | ||
| expect(screen.queryByText("KDE")).toBeNull(); | ||
| expect(screen.queryByText("XFCE")).toBeNull(); | ||
| expect(screen.queryByText("YaST Server Utilities")).toBeNull(); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.