Skip to content

Commit 3c3f6d2

Browse files
author
Tarash Agarwal
committed
Updating Linke-Shortener name to Linkry and adding Test Files for Linkry
1 parent e3b5781 commit 3c3f6d2

File tree

6 files changed

+44
-17
lines changed

6 files changed

+44
-17
lines changed

src/ui/Router.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import { LoginPage } from './pages/Login.page';
1212
import { LogoutPage } from './pages/Logout.page';
1313
import { ManageEventPage } from './pages/events/ManageEvent.page';
1414
import { ViewEventsPage } from './pages/events/ViewEvents.page';
15-
import { LinkShortener } from './pages/link-shortener/LinkShortener.page';
16-
import { ManageLinkPage } from './pages/link-shortener/ManageLink.page';
15+
import { LinkShortener } from './pages/linkry/LinkShortener.page';
16+
import { ManageLinkPage } from './pages/linkry/ManageLink.page';
1717
import { ScanTicketsPage } from './pages/tickets/ScanTickets.page';
1818
import { SelectTicketsPage } from './pages/tickets/SelectEventId.page';
1919
import { ViewTicketsPage } from './pages/tickets/ViewTickets.page';
2020
import { ManageIamPage } from './pages/iam/ManageIam.page';
21-
import { LinkShortenerAdmin } from './pages/link-shortener/LinkShortenerAdmin.page';
21+
import { LinkShortenerAdmin } from './pages/linkry/LinkShortenerAdmin.page';
2222
import { ManageProfilePage } from './pages/profile/ManageProfile.page';
2323
import { ManageStripeLinksPage } from './pages/stripe/ViewLinks.page';
2424
import { ManageRoomRequestsPage } from './pages/roomRequest/RoomRequestLanding.page';
@@ -147,11 +147,11 @@ const authenticatedRouter = createBrowserRouter([
147147
element: <ViewEventsPage />,
148148
},
149149
{
150-
path: '/link-shortener',
150+
path: '/linkry',
151151
element: <LinkShortener />,
152152
},
153153
{
154-
path: '/link-shortener/admin',
154+
path: '/linkry/admin',
155155
element: <LinkShortenerAdmin />,
156156
},
157157
{

src/ui/components/AppShell/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export const navItems = [
7474
validRoles: [AppRoles.ROOM_REQUEST_CREATE, AppRoles.ROOM_REQUEST_UPDATE],
7575
},
7676
{
77-
link: '/link-shortener',
78-
name: 'Link Shortener',
77+
link: '/linkry',
78+
name: 'Linkry',
7979
icon: IconLink,
8080
description: null,
8181
validRoles: [AppRoles.LINKS_MANAGER, AppRoles.LINKS_ADMIN],

src/ui/pages/link-shortener/LinkShortener.page.tsx renamed to src/ui/pages/linkry/LinkShortener.page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export const LinkShortener: React.FC = () => {
378378
<Button
379379
leftSection={<IconEdit size={14} />}
380380
onClick={() => {
381-
navigate('/link-shortener/admin');
381+
navigate('/linkry/admin');
382382
}}
383383
color="teal"
384384
>

src/ui/pages/link-shortener/LinkShortenerAdmin.page.tsx renamed to src/ui/pages/linkry/LinkShortenerAdmin.page.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,7 @@ export const LinkShortenerAdmin: React.FC = () => {
299299
message: 'Error retrieving admin informations',
300300
color: 'red',
301301
});
302-
navigate(
303-
new URLSearchParams(window.location.search).get('previousPage') || '/link-shortener'
304-
);
302+
navigate(new URLSearchParams(window.location.search).get('previousPage') || '/linkry');
305303
}
306304
};
307305
getEvents();
@@ -403,7 +401,7 @@ export const LinkShortenerAdmin: React.FC = () => {
403401
<Button
404402
leftSection={<IconEdit size={14} />}
405403
onClick={() => {
406-
navigate('/link-shortener');
404+
navigate('/linkry');
407405
}}
408406
color="teal"
409407
>

src/ui/pages/link-shortener/ManageLink.page.tsx renamed to src/ui/pages/linkry/ManageLink.page.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export const ManageLinkPage: React.FC = () => {
128128
notifications.show({
129129
message: 'Failed to fetch event data, please try again.',
130130
});
131-
navigate('/link-shortener');
131+
navigate('/linkry');
132132
}
133133
};
134134
startForm();
@@ -167,9 +167,7 @@ export const ManageLinkPage: React.FC = () => {
167167
? undefined
168168
: `The Link: ${realValues.redirect}, ${realValues.slug} ${realValues.access}".`,
169169
});
170-
navigate(
171-
new URLSearchParams(window.location.search).get('previousPage') || '/link-shortener'
172-
);
170+
navigate(new URLSearchParams(window.location.search).get('previousPage') || '/linkry');
173171
} catch (error) {
174172
setIsSubmitting(false);
175173
console.error('Error creating/editing link:', error);
@@ -180,7 +178,7 @@ export const ManageLinkPage: React.FC = () => {
180178
};
181179

182180
const handleFormClose = () => {
183-
navigate(new URLSearchParams(window.location.search).get('previousPage') || '/link-shortener');
181+
navigate(new URLSearchParams(window.location.search).get('previousPage') || '/linkry');
184182
};
185183

186184
const generateRandomSlug = () => {

tests/unit/linkry.tests.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { afterAll, expect, test, beforeEach, vi } from "vitest";
2+
import {
3+
DynamoDBClient,
4+
PutItemCommand,
5+
GetItemCommand,
6+
ScanCommand,
7+
} from "@aws-sdk/client-dynamodb";
8+
import { mockClient } from "aws-sdk-client-mock";
9+
import init from "../../src/api/index.js";
10+
import { createJwt } from "./auth.test.js";
11+
import {
12+
GetSecretValueCommand,
13+
SecretsManagerClient,
14+
} from "@aws-sdk/client-secrets-manager";
15+
import { secretJson, secretObject } from "./secret.testdata.js";
16+
import supertest from "supertest";
17+
import { marshall } from "@aws-sdk/util-dynamodb";
18+
19+
const ddbMock = mockClient(DynamoDBClient);
20+
const smMock = mockClient(SecretsManagerClient);
21+
const jwt_secret = secretObject["jwt_key"];
22+
vi.stubEnv("JwtSigningKey", jwt_secret);
23+
24+
// Mock the Discord client to prevent the actual Discord API call
25+
vi.mock("../../src/api/functions/discord.js", async () => {
26+
return {
27+
updateDiscord: vi.fn().mockResolvedValue({}),
28+
};
29+
});
30+
31+
const app = await init();

0 commit comments

Comments
 (0)