@@ -765,3 +765,292 @@ describe('equals', () => {
765765 ) ;
766766 } ) ;
767767} ) ;
768+
769+ describe ( 'expand' , ( ) => {
770+ test ( 'Column argument' , ( ) => {
771+ const query = db
772+ . selectFrom ( 'test' )
773+ . select ( ( eb ) => stf ( eb ) . expand ( 'geoma' , 1 ) . as ( 'alias' ) ) ;
774+ const compiled = query . compile ( ) ;
775+ expect ( compiled . sql ) . toBe (
776+ 'select ST_Expand("geoma", $1) as "alias" from "test"' ,
777+ ) ;
778+ expect ( compiled . parameters ) . toStrictEqual ( [ 1 ] ) ;
779+ } ) ;
780+ } ) ;
781+
782+ describe ( 'geoHash' , ( ) => {
783+ test ( 'Column argument' , ( ) => {
784+ const query = db
785+ . selectFrom ( 'test' )
786+ . select ( ( eb ) => stf ( eb ) . geoHash ( 'geoma' ) . as ( 'alias' ) ) ;
787+ const compiled = query . compile ( ) ;
788+ expect ( compiled . sql ) . toBe (
789+ 'select ST_GeoHash("geoma") as "alias" from "test"' ,
790+ ) ;
791+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
792+ } ) ;
793+ } ) ;
794+
795+ describe ( 'intersection' , ( ) => {
796+ test ( 'Column argument' , ( ) => {
797+ const query = db
798+ . selectFrom ( 'test' )
799+ . select ( ( eb ) => stf ( eb ) . intersection ( 'geoma' , 'geomb' ) . as ( 'alias' ) ) ;
800+ const compiled = query . compile ( ) ;
801+ expect ( compiled . sql ) . toBe (
802+ 'select ST_Intersection("geoma", "geomb") as "alias" from "test"' ,
803+ ) ;
804+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
805+ } ) ;
806+ } ) ;
807+
808+ describe ( 'intersects' , ( ) => {
809+ test ( 'Column argument' , ( ) => {
810+ const query = db
811+ . selectFrom ( 'test' )
812+ . select ( ( eb ) => stf ( eb ) . intersects ( 'geoma' , 'geomb' ) . as ( 'alias' ) ) ;
813+ const compiled = query . compile ( ) ;
814+ expect ( compiled . sql ) . toBe (
815+ 'select ST_Intersects("geoma", "geomb") as "alias" from "test"' ,
816+ ) ;
817+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
818+ } ) ;
819+ } ) ;
820+
821+ describe ( 'intersects' , ( ) => {
822+ test ( 'Column argument' , ( ) => {
823+ const query = db
824+ . selectFrom ( 'test' )
825+ . select ( ( eb ) => stf ( eb ) . intersects ( 'geoma' , 'geomb' ) . as ( 'alias' ) ) ;
826+ const compiled = query . compile ( ) ;
827+ expect ( compiled . sql ) . toBe (
828+ 'select ST_Intersects("geoma", "geomb") as "alias" from "test"' ,
829+ ) ;
830+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
831+ } ) ;
832+ } ) ;
833+
834+ describe ( 'isValid' , ( ) => {
835+ test ( 'Column argument' , ( ) => {
836+ const query = db
837+ . selectFrom ( 'test' )
838+ . select ( ( eb ) => stf ( eb ) . isValid ( 'geoma' ) . as ( 'alias' ) ) ;
839+ const compiled = query . compile ( ) ;
840+ expect ( compiled . sql ) . toBe (
841+ 'select ST_IsValid("geoma") as "alias" from "test"' ,
842+ ) ;
843+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
844+ } ) ;
845+ } ) ;
846+
847+ describe ( 'makeValid' , ( ) => {
848+ test ( 'Column argument' , ( ) => {
849+ const query = db
850+ . selectFrom ( 'test' )
851+ . select ( ( eb ) => stf ( eb ) . makeValid ( 'geoma' ) . as ( 'alias' ) ) ;
852+ const compiled = query . compile ( ) ;
853+ expect ( compiled . sql ) . toBe (
854+ 'select ST_MakeValid("geoma") as "alias" from "test"' ,
855+ ) ;
856+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
857+ } ) ;
858+ } ) ;
859+
860+ describe ( 'maxDistance' , ( ) => {
861+ test ( 'Column argument' , ( ) => {
862+ const query = db
863+ . selectFrom ( 'test' )
864+ . select ( ( eb ) => stf ( eb ) . maxDistance ( 'geoma' , 'geomb' ) . as ( 'alias' ) ) ;
865+ const compiled = query . compile ( ) ;
866+ expect ( compiled . sql ) . toBe (
867+ 'select ST_MaxDistance("geoma", "geomb") as "alias" from "test"' ,
868+ ) ;
869+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
870+ } ) ;
871+ } ) ;
872+
873+ describe ( 'overlaps' , ( ) => {
874+ test ( 'Column argument' , ( ) => {
875+ const query = db
876+ . selectFrom ( 'test' )
877+ . select ( ( eb ) => stf ( eb ) . overlaps ( 'geoma' , 'geomb' ) . as ( 'alias' ) ) ;
878+ const compiled = query . compile ( ) ;
879+ expect ( compiled . sql ) . toBe (
880+ 'select ST_Overlaps("geoma", "geomb") as "alias" from "test"' ,
881+ ) ;
882+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
883+ } ) ;
884+ } ) ;
885+
886+ describe ( 'srid' , ( ) => {
887+ test ( 'Column argument' , ( ) => {
888+ const query = db
889+ . selectFrom ( 'test' )
890+ . select ( ( eb ) => stf ( eb ) . srid ( 'geoma' ) . as ( 'alias' ) ) ;
891+ const compiled = query . compile ( ) ;
892+ expect ( compiled . sql ) . toBe ( 'select ST_SRID("geoma") as "alias" from "test"' ) ;
893+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
894+ } ) ;
895+ } ) ;
896+
897+ describe ( 'scale' , ( ) => {
898+ test ( 'Column argument' , ( ) => {
899+ const query = db
900+ . selectFrom ( 'test' )
901+ . select ( ( eb ) => stf ( eb ) . scale ( 'geoma' , 1 , 2 ) . as ( 'alias' ) ) ;
902+ const compiled = query . compile ( ) ;
903+ expect ( compiled . sql ) . toBe (
904+ 'select ST_Scale("geoma", $1, $2) as "alias" from "test"' ,
905+ ) ;
906+ expect ( compiled . parameters ) . toStrictEqual ( [ 1 , 2 ] ) ;
907+ } ) ;
908+ } ) ;
909+
910+ describe ( 'segmentize' , ( ) => {
911+ test ( 'Column argument' , ( ) => {
912+ const query = db
913+ . selectFrom ( 'test' )
914+ . select ( ( eb ) => stf ( eb ) . segmentize ( 'geoma' , 1 ) . as ( 'alias' ) ) ;
915+ const compiled = query . compile ( ) ;
916+ expect ( compiled . sql ) . toBe (
917+ 'select ST_Segmentize("geoma", $1) as "alias" from "test"' ,
918+ ) ;
919+ expect ( compiled . parameters ) . toStrictEqual ( [ 1 ] ) ;
920+ } ) ;
921+ } ) ;
922+
923+ describe ( 'setSRID' , ( ) => {
924+ test ( 'Column argument' , ( ) => {
925+ const query = db
926+ . selectFrom ( 'test' )
927+ . select ( ( eb ) => stf ( eb ) . setSRID ( 'geoma' , 1 ) . as ( 'alias' ) ) ;
928+ const compiled = query . compile ( ) ;
929+ expect ( compiled . sql ) . toBe (
930+ 'select ST_SetSRID("geoma", $1) as "alias" from "test"' ,
931+ ) ;
932+ expect ( compiled . parameters ) . toStrictEqual ( [ 1 ] ) ;
933+ } ) ;
934+ } ) ;
935+
936+ describe ( 'simplify' , ( ) => {
937+ test ( 'Column argument' , ( ) => {
938+ const query = db
939+ . selectFrom ( 'test' )
940+ . select ( ( eb ) => stf ( eb ) . simplify ( 'geoma' , 1 ) . as ( 'alias' ) ) ;
941+ const compiled = query . compile ( ) ;
942+ expect ( compiled . sql ) . toBe (
943+ 'select ST_Simplify("geoma", $1) as "alias" from "test"' ,
944+ ) ;
945+ expect ( compiled . parameters ) . toStrictEqual ( [ 1 ] ) ;
946+ } ) ;
947+ } ) ;
948+
949+ describe ( 'simplifyPreserveTopology' , ( ) => {
950+ test ( 'Column argument' , ( ) => {
951+ const query = db
952+ . selectFrom ( 'test' )
953+ . select ( ( eb ) => stf ( eb ) . simplifyPreserveTopology ( 'geoma' , 1 ) . as ( 'alias' ) ) ;
954+ const compiled = query . compile ( ) ;
955+ expect ( compiled . sql ) . toBe (
956+ 'select ST_SimplifyPreserveTopology("geoma", $1) as "alias" from "test"' ,
957+ ) ;
958+ expect ( compiled . parameters ) . toStrictEqual ( [ 1 ] ) ;
959+ } ) ;
960+ } ) ;
961+
962+ describe ( 'transform' , ( ) => {
963+ test ( 'Column argument' , ( ) => {
964+ const query = db
965+ . selectFrom ( 'test' )
966+ . select ( ( eb ) => stf ( eb ) . transform ( 'geoma' , 1 ) . as ( 'alias' ) ) ;
967+ const compiled = query . compile ( ) ;
968+ expect ( compiled . sql ) . toBe (
969+ 'select ST_Transform("geoma", $1) as "alias" from "test"' ,
970+ ) ;
971+ expect ( compiled . parameters ) . toStrictEqual ( [ 1 ] ) ;
972+ } ) ;
973+ } ) ;
974+
975+ describe ( 'translate' , ( ) => {
976+ test ( 'Column argument' , ( ) => {
977+ const query = db
978+ . selectFrom ( 'test' )
979+ . select ( ( eb ) => stf ( eb ) . translate ( 'geoma' , 1 , 2 ) . as ( 'alias' ) ) ;
980+ const compiled = query . compile ( ) ;
981+ expect ( compiled . sql ) . toBe (
982+ 'select ST_Translate("geoma", $1, $2) as "alias" from "test"' ,
983+ ) ;
984+ expect ( compiled . parameters ) . toStrictEqual ( [ 1 , 2 ] ) ;
985+ } ) ;
986+ } ) ;
987+
988+ describe ( 'union' , ( ) => {
989+ test ( 'Column argument' , ( ) => {
990+ const query = db
991+ . selectFrom ( 'test' )
992+ . select ( ( eb ) => stf ( eb ) . union ( 'geoma' , 'geomb' ) . as ( 'alias' ) ) ;
993+ const compiled = query . compile ( ) ;
994+ expect ( compiled . sql ) . toBe (
995+ 'select ST_Union("geoma", "geomb") as "alias" from "test"' ,
996+ ) ;
997+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
998+ } ) ;
999+ } ) ;
1000+
1001+ describe ( 'within' , ( ) => {
1002+ test ( 'Column argument' , ( ) => {
1003+ const query = db
1004+ . selectFrom ( 'test' )
1005+ . select ( ( eb ) => stf ( eb ) . within ( 'geoma' , 'geomb' ) . as ( 'alias' ) ) ;
1006+ const compiled = query . compile ( ) ;
1007+ expect ( compiled . sql ) . toBe (
1008+ 'select ST_Within("geoma", "geomb") as "alias" from "test"' ,
1009+ ) ;
1010+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
1011+ } ) ;
1012+ } ) ;
1013+
1014+ describe ( 'x' , ( ) => {
1015+ test ( 'Column argument' , ( ) => {
1016+ const query = db
1017+ . selectFrom ( 'test' )
1018+ . select ( ( eb ) => stf ( eb ) . x ( 'geoma' ) . as ( 'alias' ) ) ;
1019+ const compiled = query . compile ( ) ;
1020+ expect ( compiled . sql ) . toBe ( 'select ST_X("geoma") as "alias" from "test"' ) ;
1021+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
1022+ } ) ;
1023+ } ) ;
1024+
1025+ describe ( 'y' , ( ) => {
1026+ test ( 'Column argument' , ( ) => {
1027+ const query = db
1028+ . selectFrom ( 'test' )
1029+ . select ( ( eb ) => stf ( eb ) . y ( 'geoma' ) . as ( 'alias' ) ) ;
1030+ const compiled = query . compile ( ) ;
1031+ expect ( compiled . sql ) . toBe ( 'select ST_Y("geoma") as "alias" from "test"' ) ;
1032+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
1033+ } ) ;
1034+ } ) ;
1035+
1036+ describe ( 'z' , ( ) => {
1037+ test ( 'Column argument' , ( ) => {
1038+ const query = db
1039+ . selectFrom ( 'test' )
1040+ . select ( ( eb ) => stf ( eb ) . z ( 'geoma' ) . as ( 'alias' ) ) ;
1041+ const compiled = query . compile ( ) ;
1042+ expect ( compiled . sql ) . toBe ( 'select ST_Z("geoma") as "alias" from "test"' ) ;
1043+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
1044+ } ) ;
1045+ } ) ;
1046+
1047+ describe ( 'm' , ( ) => {
1048+ test ( 'Column argument' , ( ) => {
1049+ const query = db
1050+ . selectFrom ( 'test' )
1051+ . select ( ( eb ) => stf ( eb ) . m ( 'geoma' ) . as ( 'alias' ) ) ;
1052+ const compiled = query . compile ( ) ;
1053+ expect ( compiled . sql ) . toBe ( 'select ST_M("geoma") as "alias" from "test"' ) ;
1054+ expect ( compiled . parameters ) . toStrictEqual ( [ ] ) ;
1055+ } ) ;
1056+ } ) ;
0 commit comments