Skip to content

Commit

Permalink
Mock client onConnect and onDisconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed May 28, 2024
1 parent e9de732 commit 5db3e70
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions web/src/components/overview/L10nSection.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ beforeEach(() => {
// if defined outside, the mock is cleared automatically
createClient.mockImplementation(() => {
return {
onConnect: jest.fn(),
onDisconnect: jest.fn(),
l10n: l10nClientMock,
};
});
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/overview/NetworkSection.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ beforeEach(() => {
// if defined outside, the mock is cleared automatically
createClient.mockImplementation(() => {
return {
onConnect: jest.fn(),
onDisconnect: jest.fn(),
network: {
devices: devicesFn,
onNetworkChange: onNetworkChangeEventFn,
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/overview/ProductSection.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ beforeEach(() => {

createClient.mockImplementation(() => {
return {
onConnect: jest.fn(),
onDisconnect: jest.fn(),
product: {
getIssues: jest.fn().mockResolvedValue(issues),
onIssuesChange: jest.fn()
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/overview/SoftwareSection.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ let getIssuesFn = jest.fn().mockResolvedValue([]);
beforeEach(() => {
createClient.mockImplementation(() => {
return {
onConnect: jest.fn(),
onDisconnect: jest.fn(),
software: {
getStatus: getStatusFn,
getProgress: getProgressFn,
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/overview/StorageSection.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const proposalResult = {
};

const storageMock = {

probe: jest.fn().mockResolvedValue(0),
proposal: {
getAvailableDevices: jest.fn().mockResolvedValue(availableDevices),
Expand All @@ -70,7 +71,7 @@ let storage;
beforeEach(() => {
storage = { ...storageMock, proposal: { ...storageMock.proposal } };

createClient.mockImplementation(() => ({ storage }));
createClient.mockImplementation(() => ({ storage, onConnect: jest.fn(), onDisconnect: jest.fn() }));
});

it("probes storage if the storage devices are deprecated", async () => {
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/overview/UsersSection.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ beforeEach(() => {
// if defined outside, the mock is cleared automatically
createClient.mockImplementation(() => {
return {
onConnect: jest.fn(),
onDisconnect: jest.fn(),
users: {
...userClientMock,
}
Expand Down

0 comments on commit 5db3e70

Please sign in to comment.