mirror of
https://github.com/directus/directus.git
synced 2026-02-11 10:55:03 -05:00
Add unit tests to several API utility functions (#16662)
* add unit tests to several API util functions * fix timezone tests to account for daylight saving * add a note for future reference * Update api/src/utils/get-date-formatted.test.ts Co-authored-by: Brainslug <br41nslug@users.noreply.github.com> * remove unnecessary note as it is not an issue * fix getEnv mock in validate-env test Co-authored-by: Brainslug <br41nslug@users.noreply.github.com> Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
10
api/src/utils/strip-function.test.ts
Normal file
10
api/src/utils/strip-function.test.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { expect, test } from 'vitest';
|
||||
|
||||
import { stripFunction } from './strip-function';
|
||||
|
||||
test.each([
|
||||
{ field: 'year(date_created)', expected: 'date_created' },
|
||||
{ field: 'test', expected: 'test' },
|
||||
])('should return "$expected" for "$field"', ({ field, expected }) => {
|
||||
expect(stripFunction(field)).toBe(expected);
|
||||
});
|
||||
Reference in New Issue
Block a user