factor out tuple logic into from-tuple.ts
This commit is contained in:
parent
4e592fb1c9
commit
86a693b182
6 changed files with 33 additions and 12 deletions
13
packages/backend/test/unit/misc/from-tuple.ts
Normal file
13
packages/backend/test/unit/misc/from-tuple.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { fromTuple } from '@/misc/from-tuple.js';
|
||||
|
||||
describe(fromTuple, () => {
|
||||
it('should return value when value is not an array', () => {
|
||||
const value = fromTuple('abc');
|
||||
expect(value).toBe('abc');
|
||||
});
|
||||
|
||||
it('should return first element when value is an array', () => {
|
||||
const value = fromTuple(['abc']);
|
||||
expect(value).toBe('abc');
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue