Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update fees conf #377

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 13 additions & 28 deletions src/__tests__/Manager.Fee.cy.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { mount, unmount } from '@cypress/react'
import specTitle from 'cypress-sonarqube-reporter/specTitle'
import App from '../App'
import { predefinedFeeTypes, predefinedFirstDueDates } from '../conf'
import { prettyPrintMoney, statusRenderer } from '../operations/utils'
import { manager1 } from './credentials'
import specTitle from 'cypress-sonarqube-reporter/specTitle'
import {
addFeeMock,
createFeeWithManualDataMock,
createFeeWithPredefinedDataMock,
createPaymentMock,
fee1Mock,
feesMock,
manager1Mock,
student1Mock,
studentNameToBeCheckedMock,
studentsMock,
feesMock,
whoamiManagerMock,
createPaymentMock,
addFeeMock,
createFeeWithPredefinedDataMock,
createFeeWithManualDataMock,
fee1Mock
whoamiManagerMock
} from './mocks/responses'
import { manualFeeTypes, predefinedFeeTypes, predefinedFirstDueDates } from '../conf'
import { prettyPrintMoney, statusRenderer, TurnsStringIntoDate } from '../operations/utils'

const feeDateToSearch = `2022-09-11`
const feeCreatDate = 'date2'
Expand Down Expand Up @@ -138,8 +138,8 @@ describe(specTitle('Manager.Fee'), () => {
})

it('can create fees with manual fields', () => {
const monthlyAmount = 200000 //(1 + Math.floor(Math.random() * 2_000_000)).toString()
const monthsNumber = 5 //1 + Math.floor(Math.random() * 3)
const monthlyAmount = 200000
const monthsNumber = 5
const comment = 'Dummy comment'
const manuallyCreatedFees = createFeeWithManualDataMock(feeDateToSearch, monthlyAmount, comment, monthsNumber)
cy.intercept('POST', `/students/${student1Mock.id}/fees`, manuallyCreatedFees).as('createFees')
Expand All @@ -158,22 +158,7 @@ describe(specTitle('Manager.Fee'), () => {

cy.intercept('GET', `/students/${student1Mock.id}/fees?page=1&page_size=500`, addFeeMock(feesMock, manuallyCreatedFees)).as('getFees')
cy.contains('Enregistrer').click()
/*
cy.wait('@createFees').then(requestIntersection => {
const feeTypeMock = 'tuition'
let createAutomaticallyFeesBodyMock = {
comment: comment,
type: manualFeeTypes[feeTypeMock].type,
total_amount: monthlyAmount,
due_datetime: TurnsStringIntoDate(feeDateToSearch),
student_id: student1Mock.id
}
expect(requestIntersection.request.body[0]).to.deep.equal(createAutomaticallyFeesBodyMock)
expect(requestIntersection.request.body.length).to.equal(monthsNumber)
})

cy.contains('Élément créé')
*/
cy.contains('Élément créé')
unmount()
})
it('can create fees with manual fields without writing comments', () => {
Expand Down
12 changes: 5 additions & 7 deletions src/conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@ export const currentYear = new Date().getFullYear()
export const contactEmail = '[email protected]'

export const predefinedFeeTypes = {
annualTuition1x: [{ type: 'TUITION', name: 'Écolage annuel 1x', monthlyAmount: 1_740_000, monthsNumber: 1 }],
annualTuition9x: [
{ type: 'TUITION', name: 'Écolage annuel 9x', monthlyAmount: 240_000, monthsNumber: 1 },
{ type: 'TUITION', name: 'Écolage annuel 9x', monthlyAmount: 215_000, monthsNumber: 8 }
],
annualTuition1x: [{ type: 'TUITION', name: 'Écolage annuel 1x', monthlyAmount: 1_915_000, monthsNumber: 1 }],
annualTuition9x: [{ type: 'TUITION', name: 'Écolage annuel 9x', monthlyAmount: 240_000, monthsNumber: 9 }],
biAnnualTuition1x: [{ type: 'TUITION', name: 'Écolage semestriel 1x', monthlyAmount: 870_000, monthsNumber: 1 }],
hardwareConf1_8x: [{ type: 'HARDWARE', name: 'Matériel conf1 8x', monthlyAmount: 240_000, monthsNumber: 8 }],
hardwareConf2_8x: [{ type: 'HARDWARE', name: 'Matériel conf2 8x', monthlyAmount: 210_000, monthsNumber: 8 }],
entranceExam: [{ type: 'ENTRANCE_EXAM', name: 'Concours', monthlyAmount: 40_000, monthsNumber: 1 }],
knwoledgeValidationExam: [
studentInsurance: [{ type: 'STUDENT_INSURANCE', name: 'Assurance étudiante', monthlyAmount: 30_000, monthsNumber: 1 }],
knowledgeValidationExam: [
{
type: 'KNOWLEDGE_VALIDATION_EXAM',
name: 'VAE examen',
monthlyAmount: 25_000,
monthsNumber: 1
}
],
knwoledgeValidationApplication: [
knowledgeValidationApplication: [
{
type: 'KNOWLEDGE_VALIDATION_APPLICATION',
name: 'VAE application',
Expand Down
Loading