From eb5ad2ad1eb3ac59385e45024d6515b5add5cb92 Mon Sep 17 00:00:00 2001 From: Phil Reese Date: Thu, 19 Dec 2024 16:07:17 -0500 Subject: [PATCH] test: add tests and test suites around codebase --- .../Statutes/StatuteTable.vue | 3 +- .../Statutes/TableCaption.test.js | 11 ++ .../Statutes/TableCaption.vue | 2 - .../__snapshots__/TableCaption.test.js.snap | 169 ++++++++++++++++++ .../table-elements/HeaderCell.test.js | 12 +- .../Statutes/utils/urlMethods.test.js | 7 + 6 files changed, 197 insertions(+), 7 deletions(-) create mode 100644 solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/TableCaption.test.js create mode 100644 solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/__snapshots__/TableCaption.test.js.snap diff --git a/solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/StatuteTable.vue b/solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/StatuteTable.vue index 3751951572..0d221a99df 100644 --- a/solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/StatuteTable.vue +++ b/solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/StatuteTable.vue @@ -37,7 +37,6 @@ const tableSchema = computed(() => { } }); - // Get column dates from Django template const getColumnDates = () => { if (!document.getElementById("site_config")) return {}; @@ -47,7 +46,7 @@ const getColumnDates = () => { ); return rawDates; -} +}; const columnDates = getColumnDates(); diff --git a/solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/TableCaption.test.js b/solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/TableCaption.test.js new file mode 100644 index 0000000000..aeb53bcdc7 --- /dev/null +++ b/solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/TableCaption.test.js @@ -0,0 +1,11 @@ +import { render } from "@testing-library/vue"; +import { describe, it, expect } from "vitest"; + +import TableCaption from "./TableCaption.vue"; + +describe("Statute Table Caption", () => { + it(`Creates a snapshot of the Statute Selector with default props`, async () => { + const wrapper = render(TableCaption); + expect(wrapper).toMatchSnapshot(); + }); +}); diff --git a/solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/TableCaption.vue b/solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/TableCaption.vue index f659311e6d..6fef9b3ad4 100644 --- a/solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/TableCaption.vue +++ b/solution/ui/regulations/eregs-component-lib/src/components/shared-components/Statutes/TableCaption.vue @@ -1,5 +1,3 @@ - -