@@ -17,15 +17,23 @@ CREATE EXTENSION IF NOT EXISTS pgtap;
1717SET SEARCH_PATH TO pgstac, pgtap, public;
1818
1919-- Plan the tests.
20- SELECT plan(50 );
20+ SELECT plan(62 );
2121-- SELECT * FROM no_plan();
2222
2323-- Run the tests.
2424
2525-- Core
26+
27+ -- Check that schema exists
2628SELECT has_schema(' pgstac' ::name);
29+
30+ -- Check that PostGIS and PG_Partman extensions are installed and available on the path
2731SELECT has_extension(' postgis' );
2832SELECT has_extension(' pg_partman' );
33+
34+ SELECT has_table(' pgstac' ::name, ' migrations' ::name);
35+
36+
2937SELECT has_function(' pgstac' ::name, ' textarr' , ARRAY[' jsonb' ]);
3038SELECT results_eq(
3139 $$ SELECT textarr(' ["a","b","c"]' ::jsonb) $$,
@@ -46,48 +54,67 @@ SELECT results_eq(
4654 $$ SELECT ' {"a":1,"b":"b"}' ::jsonb $$,
4755 ' properties_idx returns slimmed lower case jsonb'
4856);
57+
58+ SELECT has_function(' pgstac' ::name, ' stac_geom' , ARRAY[' jsonb' ]);
59+ SELECT has_function(' pgstac' ::name, ' stac_datetime' , ARRAY[' jsonb' ]);
60+ SELECT has_function(' pgstac' ::name, ' jsonb_paths' , ARRAY[' jsonb' ]);
61+ SELECT has_function(' pgstac' ::name, ' jsonb_obj_paths' , ARRAY[' jsonb' ]);
62+ SELECT has_function(' pgstac' ::name, ' jsonb_val_paths' , ARRAY[' jsonb' ]);
63+ SELECT has_function(' pgstac' ::name, ' path_includes' , ARRAY[' text[]' ,' text[]' ]);
64+ SELECT has_function(' pgstac' ::name, ' path_excludes' , ARRAY[' text[]' ,' text[]' ]);
65+ SELECT has_function(' pgstac' ::name, ' jsonb_obj_paths_filtered' , ARRAY[' jsonb' ,' text[]' ,' text[]' ]);
66+ SELECT has_function(' pgstac' ::name, ' empty_arr' , ARRAY[' anyarray' ]);
67+ SELECT has_function(' pgstac' ::name, ' filter_jsonb' , ARRAY[' jsonb' ,' text[]' ,' text[]' ]);
68+
69+
4970-- Collections
5071SELECT has_table(' pgstac' ::name, ' collections' ::name);
5172SELECT col_is_pk(' pgstac' ::name, ' collections' ::name, ' id' , ' collections has primary key' );
73+
5274SELECT has_function(' pgstac' ::name, ' create_collection' , ARRAY[' jsonb' ]);
75+ SELECT has_function(' pgstac' ::name, ' update_collection' , ARRAY[' jsonb' ]);
76+ SELECT has_function(' pgstac' ::name, ' upsert_collection' , ARRAY[' jsonb' ]);
5377SELECT has_function(' pgstac' ::name, ' get_collection' , ARRAY[' text' ]);
78+ SELECT has_function(' pgstac' ::name, ' delete_collection' , ARRAY[' text' ]);
5479SELECT has_function(' pgstac' ::name, ' all_collections' , NULL );
55- SELECT has_function(' pgstac' ::name, ' collection_bbox' , ARRAY[' text' ]);
56- SELECT has_function(' pgstac' ::name, ' collection_temporal_extent' , ARRAY[' text' ]);
57- SELECT has_function(' pgstac' ::name, ' update_collection_extents' , NULL );
58-
59- SELECT has_function(' pgstac' ::name, ' collections_trigger_func' , ' collections trigger function exists' );
60- SELECT has_trigger(' pgstac' ::name, ' collections' , ' collections_trigger' , ' trigger exists on collections table' );
6180
6281
6382
6483
6584
6685-- Items
6786SELECT has_table(' pgstac' ::name, ' items' ::name);
68- SELECT col_is_pk(' pgstac' ::name, ' items' , ' id' , NULL );
6987
70- SELECT has_table(' pgstac' ::name, ' items_search' ::name);
71- -- SELECT col_is_pk('pgstac'::name, 'items_search'::name, 'id', 'id should be primary key');
72- SELECT is_indexed(' pgstac' ::name, ' items_search' ::name, ARRAY[' datetime' ,' id' ]);
73- SELECT is_indexed(' pgstac' ::name, ' items_search' ::name, ' properties' );
74- SELECT is_indexed(' pgstac' ::name, ' items_search' ::name, ' geometry' );
75- SELECT is_indexed(' pgstac' ::name, ' items_search' ::name, ' collection_id' );
88+ SELECT is_indexed(' pgstac' ::name, ' items' ::name, ARRAY[' datetime' ,' id' ]);
89+ SELECT is_indexed(' pgstac' ::name, ' items' ::name, ' properties' );
90+ SELECT is_indexed(' pgstac' ::name, ' items' ::name, ' geometry' );
91+ SELECT is_indexed(' pgstac' ::name, ' items' ::name, ' collection_id' );
7692
7793SELECT has_type(' pgstac' ::name, ' item' ::name);
78- SELECT is_partitioned(' pgstac' ::name,' items_search ' ::name);
94+ SELECT is_partitioned(' pgstac' ::name,' items ' ::name);
7995
8096
81- SELECT has_function(' pgstac' ::name, ' feature_to_item' , ARRAY[' jsonb' ]);
82- SELECT has_function(' pgstac' ::name, ' features_to_items' , ARRAY[' jsonb' ]);
8397SELECT has_function(' pgstac' ::name, ' get_item' , ARRAY[' text' ]);
8498SELECT has_function(' pgstac' ::name, ' delete_item' , ARRAY[' text' ]);
8599SELECT has_function(' pgstac' ::name, ' create_item' , ARRAY[' jsonb' ]);
100+ SELECT has_function(' pgstac' ::name, ' update_item' , ARRAY[' jsonb' ]);
101+ SELECT has_function(' pgstac' ::name, ' upsert_item' , ARRAY[' jsonb' ]);
102+
103+
104+
105+ SELECT has_function(' pgstac' ::name, ' analyze_empty_partitions' , NULL );
106+ SELECT has_function(' pgstac' ::name, ' backfill_partitions' , NULL );
107+ SELECT has_function(' pgstac' ::name, ' items_trigger_stmt_func' , NULL );
86108
87- SELECT has_function(' pgstac' ::name, ' items_trigger_func' , ' items trigger function exists' );
88- SELECT has_trigger(' pgstac' ::name, ' items' ::name, ' items_trigger' , ' items table has trigger' );
89109
90- SELECT has_view(' pgstac' ::name, ' items_search_partitions' ::name, ' items_search_partitions view exists' );
110+ SELECT has_view(' pgstac' ::name, ' all_items_partitions' ::name, ' all_items_partitions view exists' );
111+ SELECT has_view(' pgstac' ::name, ' items_partitions' ::name, ' items_partitions view exists' );
112+
113+ -- tools to update collection extents based on extents in items
114+ SELECT has_function(' pgstac' ::name, ' collection_bbox' , ARRAY[' text' ]);
115+ SELECT has_function(' pgstac' ::name, ' collection_temporal_extent' , ARRAY[' text' ]);
116+ SELECT has_function(' pgstac' ::name, ' update_collection_extents' , NULL );
117+
91118
92119
93120-- Search
@@ -110,4 +137,4 @@ SELECT has_function('pgstac'::name, 'search', ARRAY['jsonb']);
110137
111138-- Finish the tests and clean up.
112139SELECT * FROM finish();
113- ROLLBACK ;
140+ ROLLBACK ;
0 commit comments