Skip to content

Commit

Permalink
cleanup/fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rushtong committed Oct 17, 2023
1 parent 1589056 commit b1c4d55
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-undef */
import React from 'react';
import { DAC, User, Institution, Schema, Study } from '../../../src/libs/ajax';
import {DAC, User, Institution, Schema, Study, DataSet} from '../../../src/libs/ajax';
import DataSubmissionForm from '../../../src/pages/data_submission/DataSubmissionForm';
import { mount } from 'cypress/react';

Expand All @@ -23,6 +23,9 @@ beforeEach(() => {
cy.stub(Institution, 'list').returns([{name: 'Test Institution'}]);
cy.stub(Schema, 'datasetRegistrationV1').returns({});
cy.stub(Study, 'getStudyNames').returns([]);
cy.fixture('dataset-registration-v1').then(function (data) {
cy.stub(DataSet, 'getRegistrationSchema').returns(data);
});
});

describe('Data Access Governance', function () {
Expand Down
2 changes: 1 addition & 1 deletion cypress/fixtures/dataset-registration-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -688,4 +688,4 @@
}
}
}
}
}
2 changes: 2 additions & 0 deletions src/pages/data_submission/DataSubmissionForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@ export const DataSubmissionForm = (props) => {

// check against json schema validator to see if there are uncaught validation issues
let [valid, validation] = validateForm(registrationSchema, registration);

// check secondary validation for non-schema validation issues
if (!uniqueValidator.isValid(registration.studyName, studyNames)) {
validation.studyName = {
failed: ['unique'],
valid: false
};
valid = false;
}

if (formData.alternativeDataSharingPlan === true) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/data_submission/RegistrationValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const compileSchema = (schema) => {
};

/**
* Validates given object according to the schema in a format that
* Validates given form data object according to the schema in a format that
* our internal form components can understand.
*
* @param {*} schema The dataset registration schema
Expand Down

0 comments on commit b1c4d55

Please sign in to comment.