diff --git a/src/components/Launch/LaunchForm/inputHelpers/test/inputHelpers.test.ts b/src/components/Launch/LaunchForm/inputHelpers/test/inputHelpers.test.ts index f845e4fd1..7f0ab1cde 100644 --- a/src/components/Launch/LaunchForm/inputHelpers/test/inputHelpers.test.ts +++ b/src/components/Launch/LaunchForm/inputHelpers/test/inputHelpers.test.ts @@ -262,6 +262,10 @@ describe('validateInput', () => { generateValidityTests(inputTypes.integer, validityTestCases.integer); }); + describe('schema', () => { + generateValidityTests(inputTypes.schema, validityTestCases.schema); + }); + describe('string', () => { generateValidityTests(inputTypes.string, validityTestCases.string); }); diff --git a/src/components/Launch/LaunchForm/inputHelpers/test/testCases.ts b/src/components/Launch/LaunchForm/inputHelpers/test/testCases.ts index e79b8b1b7..7a14b9b90 100644 --- a/src/components/Launch/LaunchForm/inputHelpers/test/testCases.ts +++ b/src/components/Launch/LaunchForm/inputHelpers/test/testCases.ts @@ -193,6 +193,8 @@ export const validityTestCases = { Long.MIN_VALUE ] }, + // schema is just a specialized string input, so it has the same validity cases as string + schema: { invalid: [123, true, new Date(), {}], valid: ['', 'abcdefg'] }, string: { invalid: [123, true, new Date(), {}], valid: ['', 'abcdefg'] } }; @@ -296,6 +298,27 @@ export const literalTestCases: LiteralTestParams[] = [ Long.MIN_VALUE, primitiveLiteral({ integer: Long.MIN_VALUE }) ], + [ + inputTypes.schema, + '', + { + scalar: { + schema: { type: inputTypes.schema.literalType.schema, uri: '' } + } + } + ], + [ + inputTypes.schema, + 's3://someUri', + { + scalar: { + schema: { + type: inputTypes.schema.literalType.schema, + uri: 's3://someUri' + } + } + } + ], [inputTypes.string, '', primitiveLiteral({ stringValue: '' })], [ inputTypes.string, @@ -474,6 +497,12 @@ export const literalToInputTestCases: InputToLiteralTestParams[] = [ primitiveLiteral({ integer: Long.MIN_VALUE }), Long.MIN_VALUE.toString() ], + [inputTypes.schema, { scalar: { schema: { uri: '' } } }, ''], + [ + inputTypes.schema, + { scalar: { schema: { uri: 's3://someUri' } } }, + 's3://someUri' + ], [inputTypes.string, primitiveLiteral({ stringValue: '' }), ''], [ inputTypes.string,