-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Démo pour les données des pages collectivités
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { supabase } from "../../lib/supabase.ts"; | ||
import { | ||
assertExists, | ||
} from "https://deno.land/[email protected]/assert/assert_exists.ts"; | ||
|
||
await new Promise((r) => setTimeout(r, 0)); | ||
import { Database } from "../../lib/database.types.ts"; | ||
|
||
type labellisations = Database["public"]["Tables"]["labellisation"]["Row"] | ||
type indicateurs = Database["public"]["Tables"]["indicateur_resultat_import"]["Row"] | ||
|
||
Deno.test( | ||
"Données de labellisation historiques", | ||
// ignoré, car le seed ne contient pas les données de labellisation. | ||
{ ignore: true }, | ||
async () => { | ||
const { data, error } = await supabase.from("site_labellisation") | ||
.select("*, labellisations") | ||
.eq("collectivite_id", 3127); | ||
assertExists(data); | ||
assertExists(data[0].labellisations as labellisations); | ||
}, | ||
); | ||
|
||
Deno.test( | ||
"Indicateurs gaz effet de serre.", | ||
// ignoré, car le seed ne contient pas les données. | ||
{ ignore: true }, | ||
async () => { | ||
const { data, error } = await supabase.from("site_labellisation") | ||
.select("*, indicateurs_gaz_effet_serre") | ||
.eq("collectivite_id", 189); | ||
assertExists(data); | ||
assertExists(data[0].indicateurs_gaz_effet_serre as indicateurs); | ||
}, | ||
); | ||
|
||
Deno.test( | ||
"Indicateurs gaz effet de serre et de labellisation.", | ||
// ignoré, car le seed ne contient pas les données. | ||
{ ignore: true }, | ||
async () => { | ||
const { data, error } = await supabase.from("site_labellisation") | ||
.select("*, labellisations, indicateurs_gaz_effet_serre") | ||
.eq("collectivite_id", 189); | ||
assertExists(data); | ||
assertExists(data[0].labellisations as labellisations); | ||
assertExists(data[0].indicateurs_gaz_effet_serre as indicateurs); | ||
}, | ||
); |