mirror of
https://github.com/supabase/supabase.git
synced 2026-10-18 07:39:07 +03:00
* Add crons option in the database menu. * Add react-hook-form to the studio package.json. * Refactor the functionSelector to be used by other features. * Add the bulk of the functionality for the cron UI. Some of the code is copy-pasted from functions feature, needs to be cleaned before merging. * Tons of changes, the Create Cron sheet works now. * Added some more functionality for the cronjob feature. * Convert the Cron table to a listing with cards. * Add click-to-copy in the Auth Hooks feature. * Remove extra prop. * Fix type errors. * Fix some random issues. Fix the tests. * Fix the tests. * Add a style for disabled radio button item. * Make the default SQL snippet. Handle the case pg_net is not installed. * Fix the heading and save button when creating a new cron job. * Change the name of the custom label in the schedule dropdown. * Minor fixes. * Rename all mentions of cronjobs to cron jobs. * Always show the cron jobs link. * Rename the link from crons to cron-jobs. * Fix the disabled state for the stacked radio group. * More minor fixes. * More small fixes. * Fix the tests. * Minor UI tweaks * More minor tweaks * Add padding bottom * Add feature flag for the cron ui. * Fix the SQL function option. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { it } from 'vitest'
|
|
import { parseCronJobCommand } from './CronJobs.utils'
|
|
|
|
describe('parseCronJobCommand', () => {
|
|
it('should return a default object when the command is null', () => {
|
|
expect(parseCronJobCommand('')).toStrictEqual({ snippet: '', type: 'sql_snippet' })
|
|
})
|
|
|
|
it('should return a default object when the command is random', () => {
|
|
const command = 'some random text'
|
|
expect(parseCronJobCommand(command)).toStrictEqual({
|
|
snippet: 'some random text',
|
|
type: 'sql_snippet',
|
|
})
|
|
})
|
|
|
|
it('should return a sql function command when the command is CALL auth.jwt ()', () => {
|
|
const command = 'CALL auth.jwt ()'
|
|
expect(parseCronJobCommand(command)).toStrictEqual({
|
|
type: 'sql_function',
|
|
schema: 'auth',
|
|
functionName: 'jwt',
|
|
})
|
|
})
|
|
|
|
it('should return a edge function config when the command posts to supabase.co', () => {
|
|
const command = `select net.http_post( url:='https://_.supabase.co/functions/v1/_', headers:=jsonb_build_object(), body:=jsonb_build_object(), timeout_milliseconds:=5000 );`
|
|
expect(parseCronJobCommand(command)).toStrictEqual({
|
|
edgeFunctionName: 'https://_.supabase.co/functions/v1/_',
|
|
method: 'POST',
|
|
httpHeaders: [],
|
|
httpParameters: [],
|
|
timeoutMs: 5000,
|
|
type: 'edge_function',
|
|
})
|
|
})
|
|
})
|