Skip to content

Commit

Permalink
Démo pour les données des pages collectivités
Browse files Browse the repository at this point in the history
  • Loading branch information
derfurth committed Oct 27, 2023
1 parent 4037349 commit 5b5bdef
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions api_tests/tests/site/page_collectivite.ts
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);
},
);

0 comments on commit 5b5bdef

Please sign in to comment.