@@ -1002,6 +1002,56 @@ describe('QueryBuilder.vue', () => {
1002
1002
expect ( wrapper . vm . prevValidatedQuery . measures ) . not . toEqual ( initialValidatedQuery . measures ) ;
1003
1003
expect ( wrapper . vm . prevValidatedQuery . dimensions ) . toEqual ( initialValidatedQuery . dimensions ) ;
1004
1004
} ) ;
1005
+
1006
+ it ( 'should not set skipHeuristics to false if query is empty' , async ( ) => {
1007
+ const cube = createCubeApi ( ) ;
1008
+ jest
1009
+ . spyOn ( cube , 'request' )
1010
+ . mockImplementation ( fetchMock ( load ) )
1011
+ . mockImplementationOnce ( fetchMock ( meta ) ) ;
1012
+
1013
+ const wrapper = shallowMount ( QueryBuilder , {
1014
+ propsData : {
1015
+ cubeApi : cube ,
1016
+ query : { } ,
1017
+ } ,
1018
+ } ) ;
1019
+
1020
+ await flushPromises ( ) ;
1021
+
1022
+ expect ( wrapper . vm . skipHeuristics ) . toBeTruthy ( ) ;
1023
+ } ) ;
1024
+ it ( 'should set skipHeuristics to false if query is not empty and prevValidateQuery is not null' , async ( ) => {
1025
+ const cube = createCubeApi ( ) ;
1026
+ jest
1027
+ . spyOn ( cube , 'request' )
1028
+ . mockImplementation ( fetchMock ( load ) )
1029
+ . mockImplementationOnce ( fetchMock ( meta ) ) ;
1030
+
1031
+ const wrapper = shallowMount ( QueryBuilder , {
1032
+ propsData : {
1033
+ cubeApi : cube ,
1034
+ query : {
1035
+ measures : [ 'Orders.count' ] ,
1036
+ timeDimensions : [
1037
+ {
1038
+ dimension : 'Orders.createdAt' ,
1039
+ } ,
1040
+ ] ,
1041
+ } ,
1042
+ } ,
1043
+ } ) ;
1044
+
1045
+ const initialValidatedQuery = {
1046
+ measures : [ 'measure1' ] ,
1047
+ dimensions : [ 'dimension1' ] ,
1048
+ } ;
1049
+ wrapper . setData ( { prevValidatedQuery : initialValidatedQuery } ) ;
1050
+
1051
+ await flushPromises ( ) ;
1052
+
1053
+ expect ( wrapper . vm . skipHeuristics ) . toBeFalsy ( ) ;
1054
+ } ) ;
1005
1055
} ) ;
1006
1056
describe ( 'orderMembers' , ( ) => {
1007
1057
it ( 'does not contain time dimension if granularity is set to none' , async ( ) => {
0 commit comments