-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* beacon-table Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Ignore .stories.tsx and .js files Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * role-list-page Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * user-list-page Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * user-profile-page Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Ignore index.ts files Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * door-summary, tests, clean up unused opmode Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * doors-table, door-utils Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * lift-summary, removed lift-card Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * lifts-table Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * doors-table, lifts-table Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * remove delivery-alert-store Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * map, basic empty render test, cleanup map directory Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * map, test with office map Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * camera-control Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Revert resize observer import, using a mock resize observer for testing, address comments Signed-off-by: Aaron Chong <aaronchongth@gmail.com> --------- Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
- Loading branch information
1 parent
6e62967
commit 1a9d593
Showing
35 changed files
with
658 additions
and
939 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
44 changes: 44 additions & 0 deletions
44
packages/rmf-dashboard-framework/src/components/admin/role-list-page.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,44 @@ | ||
import { waitFor } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { RmfApiProvider } from '../../hooks'; | ||
import { RmfApi } from '../../services'; | ||
import { MockRmfApi, render, TestProviders } from '../../utils/test-utils.test'; | ||
import { RoleListPage } from './role-list-page'; | ||
|
||
describe('Role List Page', () => { | ||
const Base = (props: React.PropsWithChildren<{}>) => { | ||
const rmfApi = React.useMemo<RmfApi>(() => { | ||
const mockRmfApi = new MockRmfApi(); | ||
// mock out some api calls so they never resolves | ||
mockRmfApi.adminApi.getRolesAdminRolesGet = () => new Promise(() => {}); | ||
mockRmfApi.adminApi.createRoleAdminRolesPost = () => new Promise(() => {}); | ||
mockRmfApi.adminApi.deleteRoleAdminRolesRoleDelete = () => new Promise(() => {}); | ||
mockRmfApi.adminApi.getRolePermissionsAdminRolesRolePermissionsGet = () => | ||
new Promise(() => {}); | ||
mockRmfApi.adminApi.addRolePermissionAdminRolesRolePermissionsPost = () => | ||
new Promise(() => {}); | ||
mockRmfApi.adminApi.removeRolePermissionAdminRolesRolePermissionsRemovePost = () => | ||
new Promise(() => {}); | ||
return mockRmfApi; | ||
}, []); | ||
return ( | ||
<TestProviders> | ||
<RmfApiProvider value={rmfApi}>{props.children}</RmfApiProvider> | ||
</TestProviders> | ||
); | ||
}; | ||
|
||
it('renders role list page', async () => { | ||
await expect( | ||
waitFor(() => | ||
render( | ||
<Base> | ||
<RoleListPage /> | ||
</Base>, | ||
), | ||
), | ||
).resolves.not.toThrow(); | ||
}); | ||
}); |
44 changes: 44 additions & 0 deletions
44
packages/rmf-dashboard-framework/src/components/admin/user-list-page.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,44 @@ | ||
import { render as render_, waitFor } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { MemoryRouter } from 'react-router'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { AppControllerProvider, RmfApiProvider } from '../../hooks'; | ||
import { RmfApi } from '../../services'; | ||
import { makeMockAppController, MockRmfApi, TestProviders } from '../../utils/test-utils.test'; | ||
import { UserListPage } from './user-list-page'; | ||
|
||
const render = (ui: React.ReactNode) => | ||
render_(<AppControllerProvider value={makeMockAppController()}>{ui}</AppControllerProvider>); | ||
|
||
describe('UserListPage', () => { | ||
const Base = (props: React.PropsWithChildren<{}>) => { | ||
const rmfApi = React.useMemo<RmfApi>(() => { | ||
const mockRmfApi = new MockRmfApi(); | ||
// mock out some api calls so they never resolves | ||
mockRmfApi.adminApi.getUsersAdminUsersGet = () => new Promise(() => {}); | ||
mockRmfApi.adminApi.deleteUserAdminUsersUsernameDelete = () => new Promise(() => {}); | ||
mockRmfApi.adminApi.createUserAdminUsersPost = () => new Promise(() => {}); | ||
return mockRmfApi; | ||
}, []); | ||
return ( | ||
<TestProviders> | ||
<RmfApiProvider value={rmfApi}>{props.children}</RmfApiProvider> | ||
</TestProviders> | ||
); | ||
}; | ||
|
||
it('renders user list page', async () => { | ||
await expect( | ||
waitFor(() => | ||
render( | ||
<Base> | ||
<MemoryRouter> | ||
<UserListPage /> | ||
</MemoryRouter> | ||
</Base>, | ||
), | ||
), | ||
).resolves.not.toThrow(); | ||
}); | ||
}); |
42 changes: 42 additions & 0 deletions
42
packages/rmf-dashboard-framework/src/components/admin/user-profile-page.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,42 @@ | ||
import { render as render_, waitFor } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { AppControllerProvider, RmfApiProvider } from '../../hooks'; | ||
import { RmfApi } from '../../services'; | ||
import { makeMockAppController, MockRmfApi, TestProviders } from '../../utils/test-utils.test'; | ||
import { UserProfilePage } from './user-profile-page'; | ||
|
||
const render = (ui: React.ReactNode) => | ||
render_(<AppControllerProvider value={makeMockAppController()}>{ui}</AppControllerProvider>); | ||
|
||
describe('UserProfilePage', () => { | ||
const Base = (props: React.PropsWithChildren<{}>) => { | ||
const rmfApi = React.useMemo<RmfApi>(() => { | ||
const mockRmfApi = new MockRmfApi(); | ||
// mock out some api calls so they never resolves | ||
mockRmfApi.adminApi.getUserAdminUsersUsernameGet = () => new Promise(() => {}); | ||
mockRmfApi.adminApi.makeAdminAdminUsersUsernameMakeAdminPost = () => new Promise(() => {}); | ||
mockRmfApi.adminApi.getRolesAdminRolesGet = () => new Promise(() => {}); | ||
mockRmfApi.adminApi.setUserRolesAdminUsersUsernameRolesPut = () => new Promise(() => {}); | ||
return mockRmfApi; | ||
}, []); | ||
return ( | ||
<TestProviders> | ||
<RmfApiProvider value={rmfApi}>{props.children}</RmfApiProvider> | ||
</TestProviders> | ||
); | ||
}; | ||
|
||
it('renders user profile page', async () => { | ||
await expect( | ||
waitFor(() => | ||
render( | ||
<Base> | ||
<UserProfilePage /> | ||
</Base>, | ||
), | ||
), | ||
).resolves.not.toThrow(); | ||
}); | ||
}); |
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
36 changes: 36 additions & 0 deletions
36
packages/rmf-dashboard-framework/src/components/beacons/beacon-table.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,36 @@ | ||
import React from 'react'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { RmfApiProvider } from '../../hooks'; | ||
import { RmfApi } from '../../services'; | ||
import { MockRmfApi, render, TestProviders } from '../../utils/test-utils.test'; | ||
import { BeaconsTable } from './beacons-table'; | ||
|
||
describe('BeaconsTable', () => { | ||
const Base = (props: React.PropsWithChildren<{}>) => { | ||
const rmfApi = React.useMemo<RmfApi>(() => { | ||
const mockRmfApi = new MockRmfApi(); | ||
// mock out some api calls so they never resolves | ||
mockRmfApi.beaconsApi.getBeaconsBeaconsGet = () => new Promise(() => {}); | ||
return mockRmfApi; | ||
}, []); | ||
return ( | ||
<TestProviders> | ||
<RmfApiProvider value={rmfApi}>{props.children}</RmfApiProvider> | ||
</TestProviders> | ||
); | ||
}; | ||
|
||
it('renders with beacons table', () => { | ||
const root = render( | ||
<Base> | ||
<BeaconsTable /> | ||
</Base>, | ||
); | ||
expect(root.getByText('Name')).toBeTruthy(); | ||
expect(root.getByText('Op. Mode')).toBeTruthy(); | ||
expect(root.getByText('Level')).toBeTruthy(); | ||
expect(root.getByText('Type')).toBeTruthy(); | ||
expect(root.getByText('Beacon State')).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.