@@ -1733,4 +1733,259 @@ describe('AppClient tests', () => {
1733
1733
expect ( response . id ) . toEqual ( 'id' ) ;
1734
1734
} ) ;
1735
1735
} ) ;
1736
+
1737
+ describe ( 'getOrganizationMetadata' , ( ) => {
1738
+ beforeEach ( ( ) => {
1739
+ mockTransport = createRouterTransport ( ( { service } ) => {
1740
+ service ( AppService , {
1741
+ getOrganizationMetadata : ( ) =>
1742
+ new pb . GetOrganizationMetadataResponse ( ) ,
1743
+ } ) ;
1744
+ } ) ;
1745
+ } ) ;
1746
+
1747
+ it ( 'returns an empty object if there is no Struct' , async ( ) => {
1748
+ const response = await subject ( ) . getOrganizationMetadata ( 'orgId' ) ;
1749
+ expect ( response ) . toEqual ( { } ) ;
1750
+ } ) ;
1751
+
1752
+ it ( 'preserves the map key when a Struct is found' , async ( ) => {
1753
+ const testResponse = new pb . GetOrganizationMetadataResponse ( {
1754
+ data : Struct . fromJson ( { key1 : 'value1' } ) ,
1755
+ } ) ;
1756
+
1757
+ mockTransport = createRouterTransport ( ( { service } ) => {
1758
+ service ( AppService , {
1759
+ getOrganizationMetadata : ( ) => testResponse ,
1760
+ } ) ;
1761
+ } ) ;
1762
+
1763
+ const response = await subject ( ) . getOrganizationMetadata ( 'orgId' ) ;
1764
+ expect ( response ) . toEqual ( { key1 : 'value1' } ) ;
1765
+ } ) ;
1766
+ } ) ;
1767
+
1768
+ describe ( 'updateOrganizationMetadata' , ( ) => {
1769
+ let capturedRequest : pb . UpdateOrganizationMetadataRequest ;
1770
+
1771
+ beforeEach ( ( ) => {
1772
+ mockTransport = createRouterTransport ( ( { service } ) => {
1773
+ service ( AppService , {
1774
+ updateOrganizationMetadata : ( req ) => {
1775
+ capturedRequest = req ;
1776
+ return new pb . UpdateOrganizationMetadataResponse ( ) ;
1777
+ } ,
1778
+ } ) ;
1779
+ } ) ;
1780
+ } ) ;
1781
+
1782
+ it ( 'should handle empty metadata correctly' , async ( ) => {
1783
+ await subject ( ) . updateOrganizationMetadata ( 'orgId' , { } ) ;
1784
+
1785
+ expect ( capturedRequest ) . toEqual ( {
1786
+ organizationId : 'orgId' ,
1787
+ data : Struct . fromJson ( { } ) ,
1788
+ } ) ;
1789
+ } ) ;
1790
+
1791
+ it ( 'should successfully update metadata with valid data' , async ( ) => {
1792
+ await subject ( ) . updateOrganizationMetadata ( 'orgId' , { key1 : 'value1' } ) ;
1793
+
1794
+ expect ( capturedRequest ) . toEqual ( {
1795
+ organizationId : 'orgId' ,
1796
+ data : Struct . fromJson ( { key1 : 'value1' } ) ,
1797
+ } ) ;
1798
+ } ) ;
1799
+ } ) ;
1800
+
1801
+ describe ( 'getLocationMetadata' , ( ) => {
1802
+ beforeEach ( ( ) => {
1803
+ mockTransport = createRouterTransport ( ( { service } ) => {
1804
+ service ( AppService , {
1805
+ getLocationMetadata : ( ) => new pb . GetLocationMetadataResponse ( ) ,
1806
+ } ) ;
1807
+ } ) ;
1808
+ } ) ;
1809
+
1810
+ it ( 'returns an empty object if there is no Struct' , async ( ) => {
1811
+ const response = await subject ( ) . getLocationMetadata ( 'orgId' ) ;
1812
+ expect ( response ) . toEqual ( { } ) ;
1813
+ } ) ;
1814
+
1815
+ it ( 'preserves the map key when a Struct is found' , async ( ) => {
1816
+ const testResponse = new pb . GetLocationMetadataResponse ( {
1817
+ data : Struct . fromJson ( { key1 : 'value1' } ) ,
1818
+ } ) ;
1819
+
1820
+ mockTransport = createRouterTransport ( ( { service } ) => {
1821
+ service ( AppService , {
1822
+ getLocationMetadata : ( ) => testResponse ,
1823
+ } ) ;
1824
+ } ) ;
1825
+
1826
+ const response = await subject ( ) . getLocationMetadata ( 'orgId' ) ;
1827
+ expect ( response ) . toEqual ( { key1 : 'value1' } ) ;
1828
+ } ) ;
1829
+ } ) ;
1830
+
1831
+ describe ( 'updateLocationMetadata' , ( ) => {
1832
+ let capturedRequest : pb . UpdateLocationMetadataResponse ;
1833
+
1834
+ beforeEach ( ( ) => {
1835
+ mockTransport = createRouterTransport ( ( { service } ) => {
1836
+ service ( AppService , {
1837
+ updateLocationMetadata : ( req ) => {
1838
+ capturedRequest = req ;
1839
+ return new pb . UpdateLocationMetadataResponse ( ) ;
1840
+ } ,
1841
+ } ) ;
1842
+ } ) ;
1843
+ } ) ;
1844
+
1845
+ it ( 'should handle empty metadata correctly' , async ( ) => {
1846
+ await subject ( ) . updateLocationMetadata ( 'locId' , { } ) ;
1847
+
1848
+ expect ( capturedRequest ) . toEqual ( {
1849
+ locationId : 'locId' ,
1850
+ data : Struct . fromJson ( { } ) ,
1851
+ } ) ;
1852
+ } ) ;
1853
+
1854
+ it ( 'should successfully update metadata with valid data' , async ( ) => {
1855
+ await subject ( ) . updateLocationMetadata ( 'locId' , { key1 : 'value1' } ) ;
1856
+
1857
+ expect ( capturedRequest ) . toEqual ( {
1858
+ locationId : 'locId' ,
1859
+ data : Struct . fromJson ( { key1 : 'value1' } ) ,
1860
+ } ) ;
1861
+ } ) ;
1862
+ } ) ;
1863
+
1864
+ describe ( 'getRobotMetadata' , ( ) => {
1865
+ beforeEach ( ( ) => {
1866
+ mockTransport = createRouterTransport ( ( { service } ) => {
1867
+ service ( AppService , {
1868
+ getRobotMetadata : ( ) => new pb . GetRobotMetadataResponse ( ) ,
1869
+ } ) ;
1870
+ } ) ;
1871
+ } ) ;
1872
+
1873
+ it ( 'returns an empty object if there is no Struct' , async ( ) => {
1874
+ const response = await subject ( ) . getRobotMetadata ( 'orgId' ) ;
1875
+ expect ( response ) . toEqual ( { } ) ;
1876
+ } ) ;
1877
+
1878
+ it ( 'preserves the map key when a Struct is found' , async ( ) => {
1879
+ const testResponse = new pb . GetRobotMetadataResponse ( {
1880
+ data : Struct . fromJson ( { key1 : 'value1' } ) ,
1881
+ } ) ;
1882
+
1883
+ mockTransport = createRouterTransport ( ( { service } ) => {
1884
+ service ( AppService , {
1885
+ getRobotMetadata : ( ) => testResponse ,
1886
+ } ) ;
1887
+ } ) ;
1888
+
1889
+ const response = await subject ( ) . getRobotMetadata ( 'orgId' ) ;
1890
+ expect ( response ) . toEqual ( { key1 : 'value1' } ) ;
1891
+ } ) ;
1892
+ } ) ;
1893
+
1894
+ describe ( 'updateRobotMetadata' , ( ) => {
1895
+ let capturedRequest : pb . UpdateRobotMetadataResponse ;
1896
+
1897
+ beforeEach ( ( ) => {
1898
+ mockTransport = createRouterTransport ( ( { service } ) => {
1899
+ service ( AppService , {
1900
+ updateRobotMetadata : ( req ) => {
1901
+ capturedRequest = req ;
1902
+ return new pb . UpdateLocationMetadataResponse ( ) ;
1903
+ } ,
1904
+ } ) ;
1905
+ } ) ;
1906
+ } ) ;
1907
+
1908
+ it ( 'should handle empty metadata correctly' , async ( ) => {
1909
+ await subject ( ) . updateRobotMetadata ( 'robotId' , { } ) ;
1910
+
1911
+ expect ( capturedRequest ) . toEqual ( {
1912
+ id : 'robotId' ,
1913
+ data : Struct . fromJson ( { } ) ,
1914
+ } ) ;
1915
+ } ) ;
1916
+
1917
+ it ( 'should successfully update metadata with valid data' , async ( ) => {
1918
+ await subject ( ) . updateRobotMetadata ( 'robotId' , { key1 : 'value1' } ) ;
1919
+
1920
+ expect ( capturedRequest ) . toEqual ( {
1921
+ id : 'robotId' ,
1922
+ data : Struct . fromJson ( { key1 : 'value1' } ) ,
1923
+ } ) ;
1924
+ } ) ;
1925
+ } ) ;
1926
+
1927
+ describe ( 'getRobotPartMetadata' , ( ) => {
1928
+ beforeEach ( ( ) => {
1929
+ mockTransport = createRouterTransport ( ( { service } ) => {
1930
+ service ( AppService , {
1931
+ getRobotPartMetadata : ( ) => new pb . GetRobotPartMetadataResponse ( ) ,
1932
+ } ) ;
1933
+ } ) ;
1934
+ } ) ;
1935
+
1936
+ it ( 'returns an empty object if there is no Struct' , async ( ) => {
1937
+ const response = await subject ( ) . getRobotPartMetadata ( 'orgId' ) ;
1938
+ expect ( response ) . toEqual ( { } ) ;
1939
+ } ) ;
1940
+
1941
+ it ( 'preserves the map key when a Struct is found' , async ( ) => {
1942
+ const testResponse = new pb . GetRobotPartMetadataResponse ( {
1943
+ data : Struct . fromJson ( { key1 : 'value1' } ) ,
1944
+ } ) ;
1945
+
1946
+ mockTransport = createRouterTransport ( ( { service } ) => {
1947
+ service ( AppService , {
1948
+ getRobotPartMetadata : ( ) => testResponse ,
1949
+ } ) ;
1950
+ } ) ;
1951
+
1952
+ const response = await subject ( ) . getRobotPartMetadata ( 'orgId' ) ;
1953
+ expect ( response ) . toEqual ( { key1 : 'value1' } ) ;
1954
+ } ) ;
1955
+ } ) ;
1956
+
1957
+ describe ( 'updateRobotPartMetadata' , ( ) => {
1958
+ let capturedRequest : pb . UpdateRobotPartMetadataResponse ;
1959
+
1960
+ beforeEach ( ( ) => {
1961
+ mockTransport = createRouterTransport ( ( { service } ) => {
1962
+ service ( AppService , {
1963
+ updateRobotPartMetadata : ( req ) => {
1964
+ capturedRequest = req ;
1965
+ return new pb . UpdateRobotPartMetadataResponse ( ) ;
1966
+ } ,
1967
+ } ) ;
1968
+ } ) ;
1969
+ } ) ;
1970
+
1971
+ it ( 'should handle empty metadata correctly' , async ( ) => {
1972
+ await subject ( ) . updateRobotPartMetadata ( 'robotPartId' , { } ) ;
1973
+
1974
+ expect ( capturedRequest ) . toEqual ( {
1975
+ id : 'robotPartId' ,
1976
+ data : Struct . fromJson ( { } ) ,
1977
+ } ) ;
1978
+ } ) ;
1979
+
1980
+ it ( 'should successfully update metadata with valid data' , async ( ) => {
1981
+ await subject ( ) . updateRobotPartMetadata ( 'robotPartId' , {
1982
+ key1 : 'value1' ,
1983
+ } ) ;
1984
+
1985
+ expect ( capturedRequest ) . toEqual ( {
1986
+ id : 'robotPartId' ,
1987
+ data : Struct . fromJson ( { key1 : 'value1' } ) ,
1988
+ } ) ;
1989
+ } ) ;
1990
+ } ) ;
1736
1991
} ) ;
0 commit comments