@@ -15,6 +15,7 @@ import { ViewInfo } from '../../internal/ViewInfo';
1515import { getQueryParams } from '../../internal/util/URL' ;
1616
1717import {
18+ createQueryModelId ,
1819 DEFAULT_MAX_ROWS ,
1920 DEFAULT_OFFSET ,
2021 flattenValuesFromRow ,
@@ -56,7 +57,7 @@ describe('QueryModel', () => {
5657 expect ( model . queryName ) . toEqual ( 'mixtures' ) ;
5758 expect ( model . viewName ) . toEqual ( undefined ) ;
5859 // Auto-generated model ids are based off of the SchemaQuery in the QueryConfig
59- expect ( model . id ) . toEqual ( 'exp.data .mixtures' ) ;
60+ expect ( model . id ) . toEqual ( 'exp$Pdata .mixtures' ) ;
6061 const schemaQuery = new SchemaQuery ( 'exp.data' , 'mixtures' , 'someViewName' ) ;
6162 model = new QueryModel ( { schemaQuery } ) ;
6263 expect ( model . viewName ) . toEqual ( 'someViewName' ) ;
@@ -316,6 +317,16 @@ describe('QueryModel', () => {
316317 } ) ;
317318} ) ;
318319
320+ describe ( 'createQueryModelId' , ( ) => {
321+ test ( 'with/without special characters in schema/query' , ( ) => {
322+ expect ( createQueryModelId ( new SchemaQuery ( "samples" , "Blood" ) ) ) . toBe ( 'samples.Blood' ) ;
323+ expect ( createQueryModelId ( new SchemaQuery ( "exp.data" , "participant" ) ) ) . toBe ( 'exp$Pdata.participant' ) ;
324+ expect ( createQueryModelId ( new SchemaQuery ( "samples" , "Blood Plasma" ) ) ) . toBe ( 'samples.Blood Plasma' ) ;
325+ expect ( createQueryModelId ( new SchemaQuery ( "samples" , "Blood/Plasma" ) ) ) . toBe ( 'samples.Blood$SPlasma' ) ;
326+ expect ( createQueryModelId ( new SchemaQuery ( "exp.data" , "Blood/Plasma" ) ) ) . toBe ( 'exp$Pdata.Blood$SPlasma' ) ;
327+ } ) ;
328+ } ) ;
329+
319330describe ( 'flattenValuesFromRow' , ( ) => {
320331 test ( 'missing params' , ( ) => {
321332 expect ( JSON . stringify ( flattenValuesFromRow ( undefined , undefined ) ) ) . toBe ( '{}' ) ;
0 commit comments