Skip to content

Commit

Permalink
fix: test & orgainisation code on edit org in fbt
Browse files Browse the repository at this point in the history
  • Loading branch information
tfhuhtal committed Nov 27, 2024
1 parent 91e954e commit 6d9b5be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
10 changes: 5 additions & 5 deletions cypress/integration/organisationSurvey.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ describe('Feedback Correspondents', () => {
cy.get('[data-cy="formik-locales-field-sv-name"]').should('be.visible')
cy.get('[data-cy="formik-locales-field-en-name"]').should('be.visible')

cy.get('[data-cy="formik-date-picker-field-startDate"]').should('be.visible')
cy.get('[data-cy="formik-date-picker-field-startDate-input"]').should('be.visible')

cy.get('[data-cy="formik-date-picker-field-endDate"]').should('be.visible')
cy.get('[data-cy="formik-date-picker-field-endDate-input"]').should('be.visible')

cy.get('[data-cy="formik-responsible-teacher-input-field"]').should('be.visible')

Expand Down Expand Up @@ -77,10 +77,10 @@ describe('Feedback Correspondents', () => {
cy.get('[data-cy="formik-locales-field-en-name"]').type('Test survey')

// Assert that the startDate picker is there
cy.get('[data-cy="formik-date-picker-field-startDate"]').should('be.visible')
cy.get('[data-cy="formik-date-picker-field-startDate-input"]').should('be.visible')

// Assert that the endDate picker is there
cy.get('[data-cy="formik-date-picker-field-endDate"]').should('be.visible')
cy.get('[data-cy="formik-date-picker-field-endDate-input"]').should('be.visible')

// Assert responsible teacher input field is there
cy.get('[data-cy="formik-responsible-teacher-input-field"]').should('be.visible')
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('Feedback Correspondents', () => {

cy.get('[data-cy="organisation-survey-editor-save"]').click()

cy.get('[data-cy="formik-date-picker-field-endDate"]').parent().as('endDateInputParent')
cy.get('[data-cy="formik-date-picker-field-endDate-input"]').parent().as('endDateInputParent')
cy.get('@endDateInputParent').contains('p', 'Survey closing date is before opening date')
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ const EditOrganisationSurvey = () => {
const [showForm, setShowForm] = useState(false)
const queryClient = useQueryClient()

const { feedbackTarget, isAdmin, isResponsibleTeacher, isOrganisationAdmin, organisation } =
useFeedbackTargetContext()
const { feedbackTarget, isAdmin, isResponsibleTeacher, isOrganisationAdmin } = useFeedbackTargetContext()
const { id, courseUnit: { organisations } = [] } = feedbackTarget
const allowEdit = isAdmin || isResponsibleTeacher || isOrganisationAdmin
const { survey: organisationSurvey, isLoading } = useOrganisationSurvey(organisations[0]?.code, id, allowEdit)
Expand Down Expand Up @@ -102,7 +101,7 @@ const EditOrganisationSurvey = () => {
editing={showForm}
onStopEditing={handleClose}
editView
organisationCode={organisation.code}
organisationCode={organisations[0]?.code}
/>
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ export const useEditOrganisationSurveyMutation = organisationCode => {
},
})

console.log(mutation)

return mutation
}

Expand Down

0 comments on commit 6d9b5be

Please sign in to comment.