Skip to content

Commit

Permalink
MAJ tests suite à 3fbd8aa
Browse files Browse the repository at this point in the history
  • Loading branch information
hfroot committed Aug 31, 2023
1 parent af9c26c commit 2ebc932
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions calculations/flux/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const { getCommunes } = require('../../data/communes')
describe('Flux module integration tests', () => {
const communes = getCommunes({ epci: getEpci('200007177', true) })
test('returns expected number of entries for cultures ground changes', () => {
// only return fluxes != 0
const allFlux = getAnnualFluxes(communes).allFlux
const culturesFlux = allFlux.filter(f => f.to === 'cultures')
const cGround = culturesFlux.filter(f => f.gas === 'C' && f.reservoir === 'sol')
// 13 flux values * 12 communes in this EPCI = 156
expect(cGround.length).toBe(156)
expect(cGround.length).toBe(5)
})

// data-dependent tests
Expand Down Expand Up @@ -43,7 +43,7 @@ describe('Flux module integration tests', () => {
expect(summary.vignes.totalSequestration).toBeCloseTo(17, 0)
// the following value is wrong in the spreadsheet, so my calculations break.
summary = getAnnualFluxes(getCommunes({ epci: getEpci('200040798', true) })).summary
expect(summary.vignes.totalSequestration).toBeCloseTo(0, 0)
expect(summary.vignes).toBeUndefined()
})

test('returns correct total for zones humides', () => {
Expand All @@ -65,7 +65,7 @@ describe('Flux module integration tests', () => {
}
flux = getAnnualFluxes(getCommunes({ epci }), { areaChanges })
summary = flux.summary
// prairies to cultures results in an emission, so when reduced to 0 the sequestration value is larger
expect(summary.cultures.totalSequestration).toBeGreaterThan(originalFlux)
// there are no other changes to cultures, so the summary is undefined
expect(summary.cultures).toBeUndefined()
})
})

0 comments on commit 2ebc932

Please sign in to comment.