Skip to content

Commit 434be21

Browse files
committed
Remeda is your friend
1 parent e07eac2 commit 434be21

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

mock-api/msw/util.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
* Copyright Oxide Computer Company
77
*/
8+
import * as R from 'remeda'
89
import { describe, expect, it } from 'vitest'
910

1011
import { FLEET_ID } from '@oxide/api'
@@ -26,7 +27,7 @@ describe('paginated', () => {
2627
expect(page.items.length).toBe(100)
2728
// Items are sorted by id lexicographically (matching Omicron's UUID sorting behavior)
2829
// Use locale-agnostic comparison to match the implementation
29-
const sortedItems = [...items].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))
30+
const sortedItems = R.sortBy([...items], (i) => i.id)
3031
expect(page.items).toEqual(sortedItems.slice(0, 100))
3132
expect(page.next_page).toBe(sortedItems[99].id)
3233
})

test/e2e/utils.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,6 @@ export async function clickRowAction(page: Page, rowName: string, actionName: st
199199
await page.getByRole('menuitem', { name: actionName }).click()
200200
}
201201

202-
/**
203-
* Select a silo image
204-
*/
205202
export const selectASiloImage = async (page: Page, name: string) => {
206203
await page.getByRole('tab', { name: 'Silo images' }).click()
207204
await page.getByPlaceholder('Select a silo image', { exact: true }).click()

0 commit comments

Comments
 (0)