42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
import { createClient } from '@supabase/supabase-js'
|
|
|
|
const SUPABASE_URL = 'https://bjgixlugjzsccazdfmph.supabase.co'
|
|
const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJqZ2l4bHVnanpzY2NhemRmbXBoIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzIwNjQyMTAsImV4cCI6MjA4NzY0MDIxMH0.untLQoPi4yUr3cPnxo23wYSlg6xnNK0daKu9UHmFTp8'
|
|
const sb = createClient(SUPABASE_URL, SUPABASE_ANON_KEY)
|
|
|
|
async function test() {
|
|
await sb.auth.signInWithPassword({ email: 'admin@sibu.com', password: 'Admin123!' })
|
|
|
|
console.log("Testing REGULAR");
|
|
const { data: stopData, error: stopErr } = await sb.from('bus_stops').insert([{
|
|
name: 'test enum',
|
|
latitude: 0,
|
|
longitude: 0,
|
|
stop_type: 'REGULAR',
|
|
has_shelter: false,
|
|
has_seating: false,
|
|
is_accessible: true,
|
|
city: 'David'
|
|
}]).select()
|
|
|
|
console.log("REGULAR test:", stopErr ? stopErr.message : "Success")
|
|
|
|
if (!stopErr && stopData) {
|
|
await sb.from('bus_stops').delete().eq('id', stopData[0].id)
|
|
}
|
|
|
|
console.log("Testing regular");
|
|
const { error: err2 } = await sb.from('bus_stops').insert([{
|
|
name: 'test enum',
|
|
latitude: 0,
|
|
longitude: 0,
|
|
stop_type: 'regular',
|
|
has_shelter: false,
|
|
has_seating: false,
|
|
is_accessible: true,
|
|
city: 'David'
|
|
}]).select()
|
|
console.log("regular test:", err2 ? err2.message : "Success")
|
|
}
|
|
test()
|