-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Notification Management (clicking on Notification) (#572)
* feat(ui): update redux store * feat(ui): create notification option modal * feat(ui): implement earlier notification * feat(ui): add UT for notification detail and components * feat(ui): refactor notification item * fix(ui): fix icon of notification item * fix(ui): reset expand when nav to another page * fix(ui): fix review comment * fix(ui): fix style on android * fix(ui): fix style on android * fix(ui): fix unit test --------- Co-authored-by: Vu Van Duc <vuvanduc@Vus-MacBook-Pro.local>
- Loading branch information
1 parent
bbfc5ac
commit bf20971
Showing
22 changed files
with
1,492 additions
and
142 deletions.
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 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
105 changes: 105 additions & 0 deletions
105
src/ui/pages/NotificationDetails/NotificationDetails.test.tsx
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 |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import { IonReactMemoryRouter } from "@ionic/react-router"; | ||
import { mockIonicReact } from "@ionic/react-test-utils"; | ||
import { render, waitFor } from "@testing-library/react"; | ||
import { createMemoryHistory } from "history"; | ||
import { Provider } from "react-redux"; | ||
import configureStore from "redux-mock-store"; | ||
import EN_TRANSLATIONS from "../../../locales/en/en.json"; | ||
import { RoutePath, TabsRoutePath } from "../../../routes/paths"; | ||
import { connectionsFix } from "../../__fixtures__/connectionsFix"; | ||
import { filteredIdentifierFix } from "../../__fixtures__/filteredIdentifierFix"; | ||
import { notificationsFix } from "../../__fixtures__/notificationsFix"; | ||
import { NotificationDetails } from "./NotificationDetails"; | ||
|
||
mockIonicReact(); | ||
|
||
const getMultiSignMock = jest.fn().mockResolvedValue({ | ||
sender: { | ||
label: "CF Credential Issuance", | ||
}, | ||
otherConnections: connectionsFix, | ||
}); | ||
|
||
jest.mock("../../../core/agent/agent", () => ({ | ||
Agent: { | ||
agent: { | ||
basicStorage: { | ||
deleteById: jest.fn(() => Promise.resolve()), | ||
}, | ||
multiSigs: { | ||
getMultisigIcpDetails: () => getMultiSignMock(), | ||
}, | ||
}, | ||
}, | ||
})); | ||
|
||
const mockStore = configureStore(); | ||
const dispatchMock = jest.fn(); | ||
const initialState = { | ||
stateCache: { | ||
routes: [TabsRoutePath.NOTIFICATIONS], | ||
authentication: { | ||
loggedIn: true, | ||
time: Date.now(), | ||
passcodeIsSet: true, | ||
}, | ||
}, | ||
connectionsCache: { | ||
connections: [], | ||
}, | ||
identifiersCache: { | ||
identifiers: filteredIdentifierFix, | ||
}, | ||
notificationsCache: { | ||
notifications: notificationsFix, | ||
}, | ||
}; | ||
|
||
describe("Notification Detail", () => { | ||
test("render credential receiver request", async () => { | ||
const storeMocked = { | ||
...mockStore(initialState), | ||
dispatch: dispatchMock, | ||
}; | ||
|
||
const history = createMemoryHistory(); | ||
history.push(RoutePath.CONNECTION_DETAILS, notificationsFix[0]); | ||
|
||
const { getByText } = render( | ||
<IonReactMemoryRouter history={history}> | ||
<Provider store={storeMocked}> | ||
<NotificationDetails /> | ||
</Provider> | ||
</IonReactMemoryRouter> | ||
); | ||
expect( | ||
getByText(EN_TRANSLATIONS.notifications.details.credential.receive.title) | ||
).toBeVisible(); | ||
expect( | ||
getByText(EN_TRANSLATIONS.notifications.details.buttons.close) | ||
).toBeVisible(); | ||
}); | ||
|
||
test("render mutil-sign request", async () => { | ||
const storeMocked = { | ||
...mockStore(initialState), | ||
dispatch: dispatchMock, | ||
}; | ||
|
||
const history = createMemoryHistory(); | ||
history.push(RoutePath.CONNECTION_DETAILS, notificationsFix[3]); | ||
|
||
const { getByText } = render( | ||
<IonReactMemoryRouter history={history}> | ||
<Provider store={storeMocked}> | ||
<NotificationDetails /> | ||
</Provider> | ||
</IonReactMemoryRouter> | ||
); | ||
await waitFor(() => { | ||
expect( | ||
getByText(EN_TRANSLATIONS.notifications.details.identifier.title) | ||
).toBeVisible(); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -41,6 +41,10 @@ | |
margin-bottom: 1.5rem; | ||
|
||
ion-list { | ||
&.md { | ||
padding: 0; | ||
} | ||
|
||
ion-grid { | ||
padding: 0; | ||
|
||
|
Oops, something went wrong.