Skip to content

Commit

Permalink
test(seed): add yes we hack organization
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Sep 27, 2024
1 parent 23202c2 commit 02b7d37
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 1 deletion.
32 changes: 32 additions & 0 deletions e2e/features/organizations/yes_we_hack_domain_verification.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#language: fr
Fonctionnalité: Page organisation - domaine à vérifier

Contexte:
Soit une base de données nourrie au grain
Quand je navigue sur la page
* je vois "Bonjour Hyyypertool !"
* je clique sur le bouton "AgentConnect"

Scénario:
Quand je clique sur "Domaines à verifier"
Alors je suis redirigé sur "/organizations/domains"
* je vois "Liste des domaines à vérifier"
* je vois la ligne de table "81403721400016"
* sur la même ligne je vois "Yes we hack"

Quand sur la même ligne je clique sur "➡️"
Alors je vois "A propos de « Yes we hack »"
* je vois "Dénomination : Yes we hack"

Soit le tableau sous le title "Domaines de l'organisation"
* je vois la ligne "yeswehack.com" dans le tableau
* sur la même ligne je vois "❓"

Quand j'ouvre le menu déroulant sur la même ligne
Et je clique sur "✅ Domain autorisé"
Alors je vois la ligne "yeswehack.com" dans le tableau
Et sur la même ligne je vois "✅"

Quand je clique sur "Domaines à verifier"
Et je clique sur "Rafraichir"
* le tableau sous le title "Domaines de l'organisation"
8 changes: 8 additions & 0 deletions packages/~/infra/moncomptepro/database/src/seed/insert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type { MCP_Moderation } from "@~/moncomptepro.lib/moncomptepro.d";
import consola from "consola";
import type { MonComptePro_PgDatabase } from "../index";
import { schema } from "../index";
import { insert_commune_de_pompierre } from "./organizations/commune_de_pompierre";
import { insert_yes_we_hack } from "./organizations/yes_we_hack";

//

Expand Down Expand Up @@ -54,6 +56,12 @@ export async function insert_database(db: MonComptePro_PgDatabase) {
);
const sak = await insert_sak(db);
consola.verbose(`🌱 INSERT organization ${sak.cached_nom_complet}`);
const yes_we_hack = await insert_yes_we_hack(db);
consola.verbose(`🌱 INSERT organization yes_we_hack (id: ${yes_we_hack})`);
const commune_de_pompierre = await insert_commune_de_pompierre(db);
consola.verbose(
`🌱 INSERT organization commune_de_pompierre (id: ${commune_de_pompierre})`,
);

//

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//

import { schema, type MonComptePro_PgDatabase } from "../..";

export async function insert_commune_de_pompierre(pg: MonComptePro_PgDatabase) {
const [{ id: organization_id }] = await pg
.insert(schema.organizations)
.values({
cached_activite_principale: "84.11Z",
cached_adresse: "6 rue du chevalier de la barre, 88300 Pompierre",
cached_categorie_juridique: "7210",
cached_code_officiel_geographique: null,
cached_code_postal: "88300",
cached_enseigne: "Mairie",
cached_est_active: true,
cached_est_diffusible: true,
cached_etat_administratif: "A",
cached_libelle_activite_principale:
"84.11Z - Administration publique générale",
cached_libelle_categorie_juridique: "Commune et commune nouvelle",
cached_libelle_tranche_effectif: "1 ou 2 salariés, en 2019",
cached_libelle: "Commune de pompierre - Mairie",
cached_nom_complet: "Commune de pompierre",
cached_statut_diffusion: "O",
cached_tranche_effectifs_unite_legale: "02",
cached_tranche_effectifs: "01",
created_at: "2022-04-11 15:31:44.199+00",
organization_info_fetched_at: "2022-08-08 17:36:27.443+00",
siret: "21880352600019",
updated_at: "2022-04-11 15:31:44.199+00",
})
.returning({ id: schema.organizations.id });

await pg.insert(schema.email_domains).values({
organization_id,
domain: "9online.fr",
verification_type: null,
can_be_suggested: true,
verified_at: null,
created_at: "2022-04-11 15:31:44.199+00",
updated_at: "2022-04-11 15:31:44.199+00",
});

return organization_id;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//

import { schema, type MonComptePro_PgDatabase } from "../..";

export async function insert_yes_we_hack(pg: MonComptePro_PgDatabase) {
const [{ id: organization_id }] = await pg
.insert(schema.organizations)
.values({
cached_activite_principale: "62.09Z",
cached_adresse: "14 rue charles v, 75004 Paris",
cached_categorie_juridique: "5710",
cached_code_officiel_geographique: "75104",
cached_code_postal: "75004",
cached_enseigne: "",
cached_est_active: true,
cached_est_diffusible: true,
cached_etat_administratif: "A",
cached_libelle_activite_principale:
"62.09Z - Autres activités informatiques",
cached_libelle_categorie_juridique: "SAS, société par actions simplifiée",
cached_libelle_tranche_effectif: "20 à 49 salariés, en 2021",
cached_libelle: "Yes we hack",
cached_nom_complet: "Yes we hack",
cached_statut_diffusion: "O",
cached_tranche_effectifs_unite_legale: "21",
cached_tranche_effectifs: "12",
created_at: "2023-12-19 10:02:33.274+00",
organization_info_fetched_at: "2024-09-24 09:15:41.308+00",
siret: "81403721400016",
updated_at: "2024-09-24 09:15:41.308+00",
})
.returning({ id: schema.organizations.id });

await pg.insert(schema.email_domains).values({
organization_id,
domain: "yeswehack.com",
verification_type: null,
can_be_suggested: true,
verified_at: "2024-03-26 05:37:24.197+00",
created_at: "2023-12-19 10:02:33.274+00",
updated_at: "2024-03-26 05:37:24.197+00",
});

return organization_id;
}
2 changes: 1 addition & 1 deletion packages/~/organizations/api/src/domaines/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export default new Hono().use("/", jsxRenderer(Main_Layout)).get(
const hx_domains_query_props = {
...(await hx_urls.organizations.domains.$get({ query: {} })),
"hx-include": hx_include([
$table,
$search,
$table,
query_schema.keyof().enum.page,
]),
"hx-replace-url": true,
Expand Down

0 comments on commit 02b7d37

Please sign in to comment.