@@ -317,7 +317,7 @@ describe('Import with update / merge', () => {
317317 it ( "Issue 52922: Blank sample id in the file are getting ignored in update from file" , async ( ) => {
318318 const BLANK_KEY_UPDATE_ERROR = 'Name value not provided on row ' ;
319319 const BLANK_KEY_MERGE_ERROR_NO_EXPRESSION = 'SampleID or Name is required for sample on row' ;
320- const BOGUS_KEY_UPDATE_ERROR = 'Sample not found : bogus.' ;
320+ const BOGUS_KEY_UPDATE_ERROR = 'Sample does not exist : bogus.' ;
321321 const CROSS_FOLDER_UPDATE_NOT_SUPPORTED_ERROR = "Sample does not belong to " ;
322322
323323 const dataType = SAMPLE_ALIQUOT_IMPORT_NO_NAME_PATTERN_NAME ;
@@ -394,7 +394,6 @@ describe('Aliquot crud', () => {
394394 const aliquotQueryCols = 'name, rowid, lsid, description, str, int, isAliquot, AliquotedFromLsid/name, rootmaterialrowid, Myparentcol, Myaliquotcol, Myindependentcol' ;
395395
396396 async function verifyImportingWithNameValue ( parentSampleName : string , sampleType : string ) {
397- console . log ( 'Selected parentSampleName: ' + parentSampleName ) ;
398397 const parentInsertRow = {
399398 name : parentSampleName ,
400399 description : 'testImportingWithNameValue parent'
@@ -721,19 +720,19 @@ describe('Aliquot crud', () => {
721720 importText = "Description\tAliquotedFrom\n" ;
722721 importText += aliquotDesc + "\t" + absentRootSample + "\n" ;
723722 let resp = await ExperimentCRUDUtils . importSample ( server , importText , SAMPLE_ALIQUOT_IMPORT_TYPE_NAME , "IMPORT" , topFolderOptions , editorUserOptions ) ;
724- expect ( resp . text ) . toContain ( "Aliquot parent 'Absent_Root' not found." ) ;
723+ expect ( resp . text . indexOf ( "Aliquot parent 'Absent_Root' not found." ) > - 1 ) . toBeTruthy ( ) ;
725724 const invalidRootSample = "Not_This_Root" ;
726725 await ExperimentCRUDUtils . insertSamples ( server , [ { name : invalidRootSample } ] , SAMPLE_ALIQUOT_IMPORT_TYPE_NAME , topFolderOptions , editorUserOptions )
727726
728727 importText = "Name\tDescription\tAliquotedFrom\n" ;
729728 importText += aliquot01 + "\t" + aliquotDesc + "\t" + invalidRootSample + "\n" ;
730729 // Validate that if the AliquotedFrom field has an invalid value the import fails.
731730 resp = await ExperimentCRUDUtils . importSample ( server , importText , SAMPLE_ALIQUOT_IMPORT_TYPE_NAME , "IMPORT" , topFolderOptions , editorUserOptions ) ;
732- expect ( resp . text ) . toContain ( "already exists" ) ;
731+ expect ( resp . text . indexOf ( "duplicate key" ) > - 1 ) . toBeTruthy ( ) ;
733732
734733 // Validate that the AliquotedFrom field of an aliquot cannot be updated.
735734 resp = await ExperimentCRUDUtils . importSample ( server , importText , SAMPLE_ALIQUOT_IMPORT_TYPE_NAME , "MERGE" , topFolderOptions , editorUserOptions ) ;
736- expect ( resp . text ) . toContain ( "Aliquot parents cannot be updated for sample testInvalidImportCasesParent1-1." ) ;
735+ expect ( resp . text . indexOf ( "Aliquot parents cannot be updated for sample testInvalidImportCasesParent1-1." ) > - 1 ) . toBeTruthy ( ) ;
737736
738737 // AliquotedFrom is ignored for UPDATE option
739738 resp = await ExperimentCRUDUtils . importSample ( server , importText , SAMPLE_ALIQUOT_IMPORT_TYPE_NAME , "UPDATE" , topFolderOptions , editorUserOptions ) ;
@@ -752,7 +751,7 @@ describe('Aliquot crud', () => {
752751 importText = "Name\tAliquotedFrom\n" ;
753752 importText += invalidRootSample + "\t" + parentSampleName + "\n" ;
754753 resp = await ExperimentCRUDUtils . importSample ( server , importText , SAMPLE_ALIQUOT_IMPORT_TYPE_NAME , "MERGE" , topFolderOptions , editorUserOptions ) ;
755- expect ( resp . text ) . toContain ( "Unable to change sample to aliquot Not_This_Root." ) ;
754+ expect ( resp . text . indexOf ( "Unable to change sample to aliquot Not_This_Root." ) > - 1 ) . toBeTruthy ( ) ;
756755 } ) ;
757756
758757 /**
@@ -957,135 +956,3 @@ describe('Aliquot crud', () => {
957956
958957} ) ;
959958
960- describe ( 'Duplicate IDs' , ( ) => {
961- it ( "Issue 52657: We shouldn't allow creating sample names that differ only in case." , async ( ) => {
962- const sampleTypeName = 'Type Case Sensitive' ;
963- let field = { name : 'case' , rangeURI : 'http://www.w3.org/2001/XMLSchema#string' } ;
964- const domainPayload = {
965- kind : 'SampleSet' ,
966- domainDesign : { name : sampleTypeName , fields : [ { name : 'Name' } , field ] } ,
967- options : {
968- name : sampleTypeName ,
969- nameExpression : 'S-${case}'
970- }
971- } ;
972- await server . post ( 'property' , 'createDomain' , domainPayload , { ...topFolderOptions , ...designerReaderOptions } ) . expect ( successfulResponse ) ;
973-
974- const NAME_EXIST_MSG = "The name '%%' already exists." ;
975- const sample1 = 'S-case-sAmple1' ;
976- const sample2 = 'S-case-sAmple2' ;
977-
978- let insertRows = [ {
979- name : sample1 ,
980- } , {
981- name : sample2 ,
982- } ] ;
983- const sampleRows = await ExperimentCRUDUtils . insertSamples ( server , insertRows , sampleTypeName , topFolderOptions , editorUserOptions ) ;
984- const sample1RowId = caseInsensitive ( sampleRows [ 0 ] , 'rowId' ) ;
985- const sample1Lsid = caseInsensitive ( sampleRows [ 0 ] , 'lsid' ) ;
986- const sample2RowId = caseInsensitive ( sampleRows [ 1 ] , 'rowId' ) ;
987- const sample2Lsid = caseInsensitive ( sampleRows [ 1 ] , 'lsid' ) ;
988-
989- let expectedError = NAME_EXIST_MSG . replace ( '%%' , 'S-case-sample1' ) ;
990- // import
991- let errorResp = await ExperimentCRUDUtils . importSample ( server , "Name\tDescription\nS-case-sample1\tbad\ns-case-sample2\tbad" , sampleTypeName , "IMPORT" , topFolderOptions , editorUserOptions ) ;
992- expect ( errorResp . text ) . toContain ( expectedError ) ;
993-
994- // merge
995- let mergeError = 'The name \'S-case-sample1\' could not be resolved. Please check the casing of the provided name.' ;
996- errorResp = await ExperimentCRUDUtils . importSample ( server , "Name\tDescription\nS-case-sample1\tbad\ns-case-sample2\tbad" , sampleTypeName , "MERGE" , topFolderOptions , editorUserOptions ) ;
997- expect ( errorResp . text ) . toContain ( mergeError ) ;
998-
999- // insert
1000- await server . post ( 'query' , 'insertRows' , {
1001- schemaName : 'samples' ,
1002- queryName : sampleTypeName ,
1003- rows : [ {
1004- name : 'S-case-sample1' ,
1005- } ]
1006- } , { ...topFolderOptions , ...editorUserOptions } ) . expect ( ( result ) => {
1007- const errorResp = JSON . parse ( result . text ) ;
1008- expect ( errorResp [ 'exception' ] ) . toBe ( expectedError ) ;
1009- } ) ;
1010-
1011- // insert using naming expression to create case-insensitive name
1012- await server . post ( 'query' , 'insertRows' , {
1013- schemaName : 'samples' ,
1014- queryName : sampleTypeName ,
1015- rows : [ {
1016- case : 'case-sample1' ,
1017- } ]
1018- } , { ...topFolderOptions , ...editorUserOptions } ) . expect ( ( result ) => {
1019- const errorResp = JSON . parse ( result . text ) ;
1020- expect ( errorResp [ 'exception' ] ) . toBe ( expectedError ) ;
1021- } ) ;
1022-
1023- // renaming sample to another sample's case-insensitive name, using rowId
1024- await server . post ( 'query' , 'updateRows' , {
1025- schemaName : 'samples' ,
1026- queryName : sampleTypeName ,
1027- rows : [ {
1028- name : 'S-case-sample2' ,
1029- rowId : sample1RowId
1030- } ]
1031- } , { ...topFolderOptions , ...editorUserOptions } ) . expect ( ( result ) => {
1032- errorResp = JSON . parse ( result . text ) ;
1033- expect ( errorResp [ 'exception' ] ) . toBe ( NAME_EXIST_MSG . replace ( '%%' , 'S-case-sample2' ) ) ;
1034- } ) ;
1035-
1036- // renaming sample to another sample's case-insensitive name, using lsid. Currently can only be done using api
1037- await server . post ( 'query' , 'updateRows' , {
1038- schemaName : 'samples' ,
1039- queryName : sampleTypeName ,
1040- rows : [ {
1041- name : 'S-case-sample2' ,
1042- lsid : sample1Lsid
1043- } ]
1044- } , { ...topFolderOptions , ...editorUserOptions } ) . expect ( ( result ) => {
1045- errorResp = JSON . parse ( result . text ) ;
1046- expect ( errorResp [ 'exception' ] ) . toBe ( NAME_EXIST_MSG . replace ( '%%' , 'S-case-sample2' ) ) ;
1047- } ) ;
1048-
1049- // swap names (fail)
1050- await server . post ( 'query' , 'updateRows' , {
1051- schemaName : 'samples' ,
1052- queryName : sampleTypeName ,
1053- rows : [ {
1054- name : 'S-case-sample2' ,
1055- lsid : sample1Lsid
1056- } , {
1057- name : 'S-case-sample1' ,
1058- lsid : sample2Lsid
1059- } ]
1060- } , { ...topFolderOptions , ...editorUserOptions } ) . expect ( ( result ) => {
1061- errorResp = JSON . parse ( result . text ) ;
1062- expect ( errorResp [ 'exception' ] ) . toBe ( NAME_EXIST_MSG . replace ( '%%' , 'S-case-sample2' ) ) ;
1063- } ) ;
1064-
1065- await server . post ( 'query' , 'updateRows' , {
1066- schemaName : 'samples' ,
1067- queryName : sampleTypeName ,
1068- rows : [ {
1069- name : 'S-case-sample2' ,
1070- rowId : sample1RowId
1071- } , {
1072- name : 'S-case-sample1' ,
1073- rowId : sample2RowId
1074- } ]
1075- } , { ...topFolderOptions , ...editorUserOptions } ) . expect ( ( result ) => {
1076- errorResp = JSON . parse ( result . text ) ;
1077- expect ( errorResp [ 'exception' ] ) . toBe ( NAME_EXIST_MSG . replace ( '%%' , 'S-case-sample2' ) ) ;
1078- } ) ;
1079-
1080- // renaming current sample to case-insensitive name, using rowId
1081- let results = await ExperimentCRUDUtils . updateSamples ( server , [ { name : 'S-CASE-sample1' , rowId : sample1RowId } ] , sampleTypeName , topFolderOptions , editorUserOptions ) ;
1082- expect ( caseInsensitive ( results [ 0 ] , 'Name' ) ) . toBe ( 'S-CASE-sample1' ) ;
1083-
1084- // renaming current sample to case-insensitive name, using lsid
1085- results = await ExperimentCRUDUtils . updateSamples ( server , [ { name : 's-case-SAMPLE1' , lsid : sample1Lsid } ] , sampleTypeName , topFolderOptions , editorUserOptions ) ;
1086- expect ( caseInsensitive ( results [ 0 ] , 'Name' ) ) . toBe ( 's-case-SAMPLE1' ) ;
1087-
1088- } ) ;
1089-
1090- } )
1091-
0 commit comments