mirror of
https://github.com/supabase/supabase.git
synced 2026-05-13 22:20:32 +08:00
* Refactor `StorageMenu` modals to replace deprecated patterns * add test for `DeleteBucketModal` and update test setup Note: Because this component uses `useParams`, it's necessary to have the dynamic route segment passed to `next-router-mock`'s `createDynamicRouteParser`. In order not to have to manually list all of these as the application grows, I added a glob utility that uses the `pages/` directory to automatically generate an array of dynamic route paths in this case. * add test for `EmptyBucketModal` * add test for `EditBucketModal` and add `isNonNullable` utility function * add test for `CreateBucketModal` * implement requested changes * implement visual fixes
27 lines
576 B
TypeScript
27 lines
576 B
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { isNonNullable } from './isNonNullable.js'
|
|
|
|
describe(`isNonNullable`, () => {
|
|
it.each([
|
|
[null, false],
|
|
[undefined, false],
|
|
// void
|
|
[(() => {})(), false],
|
|
// Truthy
|
|
[`string`, true],
|
|
[1, true],
|
|
[true, true],
|
|
// Falsy
|
|
[``, true],
|
|
[NaN, true],
|
|
[0, true],
|
|
[0, true],
|
|
[false, true],
|
|
// Type coercion
|
|
[[], true],
|
|
[{}, true],
|
|
])(`correctly matches against nullish values`, (val, expected) => {
|
|
expect(isNonNullable(val)).toStrictEqual(expected)
|
|
})
|
|
})
|