-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #319 from AgenceBio/feature/sort-exports
- Loading branch information
Showing
15 changed files
with
247 additions
and
103 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,22 @@ | ||
import { describe, expect, it } from "vitest" | ||
import { mount } from "@vue/test-utils" | ||
|
||
import { CERTIFICATION_STATE } from '@/referentiels/ab.js' | ||
import State from "./State.vue" | ||
|
||
describe("CertificationState", () => { | ||
it("renders N/C for an unknown or empty state", async () => { | ||
let wrapper = mount(State, { props: { 'state': undefined } }) | ||
expect(wrapper.text()).toContain("Non renseigné") | ||
|
||
wrapper = mount(State, { props: { 'state': CERTIFICATION_STATE.UNKNOWN } }) | ||
expect(wrapper.text()).toContain("Non renseigné") | ||
expect(wrapper.attributes()).toHaveProperty('aria-label', "Non renseigné") | ||
}) | ||
|
||
it("renders a date suffix when provided", async () => { | ||
const wrapper = mount(State, { props: { 'state': CERTIFICATION_STATE.CERTIFIED, date: new Date('2023-01-01') } }) | ||
expect(wrapper.text()).toContain("Certifié 2023") | ||
expect(wrapper.attributes()).toHaveProperty('aria-label', "Certifié en 2023") | ||
}) | ||
}) |
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
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
109 changes: 109 additions & 0 deletions
109
src/components/Features/ExportStrategies/BureauVeritasExporter.test.js
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,109 @@ | ||
import { describe, test, expect, vi } from 'vitest' | ||
import { usePermissions } from '@/stores/index.js' | ||
import { createTestingPinia } from "@pinia/testing" | ||
import Exporter from './BureauVeritasExporter.js' | ||
import record from '@/components/Features/__fixtures__/record-for-exports.json' assert { type: 'json' } | ||
|
||
const pinia = createTestingPinia({ createSpy: vi.fn }) | ||
const permissions = usePermissions(pinia) | ||
permissions.isOc = true | ||
|
||
describe('BureauVeritasExporter', () => { | ||
test('list by features', () => { | ||
const exporter = new Exporter({ | ||
featureCollection: record.parcelles, | ||
operator: record.operator, | ||
record: record, | ||
permissions | ||
}) | ||
|
||
const expectation = [ | ||
[ | ||
"SITE ID de l'opérateur", | ||
"Catégorie", | ||
"Produit", | ||
"Code Produit", | ||
"Complément certificat", | ||
"Autres infos", | ||
"Surface", | ||
"Unité", | ||
"Classement", | ||
"Date conversion" | ||
], | ||
[ | ||
"27B/6", | ||
"", | ||
"[ERREUR] culture absente", | ||
"", | ||
"", | ||
"Ilots : 4.1", | ||
1.0464881572673355, | ||
"ha", | ||
"", | ||
"", | ||
], | ||
[ | ||
"PV", | ||
"", | ||
"[ERREUR] culture inconnue (01.19.99)", | ||
"", | ||
"", | ||
"Ilots : 3.1", | ||
1.0464881572673355, | ||
"ha", | ||
"", | ||
"", | ||
], | ||
[ | ||
"", | ||
"Surfaces fourragères", | ||
"Luzerne", | ||
"1125", | ||
"", | ||
"Ilots : 1.1 ; 1.2", | ||
2.092976314534671, | ||
"ha", | ||
"C1", | ||
"2023-01-01", | ||
], | ||
[ | ||
"", | ||
"Surfaces fourragères", | ||
"Luzerne", | ||
"1125", | ||
"", | ||
"Ilots : 2.1, 0.70ha", | ||
1.0464881572673355, | ||
"ha", | ||
"AB", | ||
"2021-01-01", | ||
], | ||
[ | ||
"", | ||
"Surfaces fourragères", | ||
"Trèfle", | ||
"1124", | ||
"4 feuilles", | ||
"Ilots : 2.1, 4 feuilles, semis le 01/03/2023, 0.30ha", | ||
1.0464881572673355, | ||
"ha", | ||
"AB", | ||
"2021-01-01", | ||
], | ||
[ | ||
"", | ||
"Surfaces fourragères", | ||
"Trèfle", | ||
"1124", | ||
"4 feuilles", | ||
"Ilots : 2.2, 4 feuilles, semis le 01/03/2023", | ||
1.0464881572673355, | ||
"ha", | ||
"AB", | ||
"2015-01-01", | ||
], | ||
] | ||
|
||
expect(exporter.toJSON()).toEqual(expectation) | ||
}) | ||
}) |
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
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
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
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
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
Oops, something went wrong.