Skip to content

Commit 58abdb0

Browse files
authored
fix: export custom header methods (#552)
Fixes #551
1 parent 1469f3f commit 58abdb0

File tree

3 files changed

+51
-33
lines changed

3 files changed

+51
-33
lines changed
Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import MapLibreGL from "../src";
22

3-
// Assert that all required MapLibre modules are accessible and exported
4-
describe("Public Interface", () => {
3+
describe("Package Exports", () => {
54
it("should contain all expected components and utils", () => {
65
const actualKeys = Object.keys(MapLibreGL);
6+
77
const expectedKeys = [
8-
// components
8+
// Components
99
"MapView",
10-
// 'StyleSheet',
1110
"Light",
1211
"PointAnnotation",
1312
"MarkerView",
@@ -44,52 +43,58 @@ describe("Public Interface", () => {
4443
"UserTrackingMode",
4544
"UserLocationRenderMode",
4645
"StyleURL",
47-
"EventTypes",
46+
// "EventTypes",
4847
"CameraModes",
4948
"StyleSource",
50-
"InterpolationMode",
49+
// "InterpolationMode",
5150
"LineJoin",
52-
"LineCap",
53-
"LineTranslateAnchor",
54-
"CirclePitchScale",
55-
"CircleTranslateAnchor",
51+
// "LineCap",
52+
// "LineTranslateAnchor",
53+
// "CirclePitchScale",
54+
// "CircleTranslateAnchor",
5655
// 'CirclePitchAlignment',
57-
"FillExtrusionTranslateAnchor",
58-
"FillTranslateAnchor",
59-
"IconRotationAlignment",
60-
"IconTextFit",
56+
// "FillExtrusionTranslateAnchor",
57+
// "FillTranslateAnchor",
58+
// "IconRotationAlignment",
59+
// "IconTextFit",
6160
// 'IconAnchor',
62-
"IconTranslateAnchor",
61+
// "IconTranslateAnchor",
6362
// 'IconPitchAlignment',
64-
"SymbolPlacement",
65-
"TextAnchor",
66-
"TextJustify",
67-
"TextPitchAlignment",
68-
"TextRotationAlignment",
69-
"TextTransform",
70-
"TextTranslateAnchor",
71-
"LightAnchor",
63+
// "SymbolPlacement",
64+
// "TextAnchor",
65+
// "TextJustify",
66+
// "TextPitchAlignment",
67+
// "TextRotationAlignment",
68+
// "TextTransform",
69+
// "TextTranslateAnchor",
70+
// "LightAnchor",
71+
7272
"OfflinePackDownloadState",
73-
"OfflineCallbackName",
73+
// "OfflineCallbackName",
74+
75+
// Methods
7476

75-
// methods
7677
"setAccessToken",
7778
"getAccessToken",
79+
80+
"addCustomHeader",
81+
"removeCustomHeader",
82+
7883
"setConnected",
7984
"requestAndroidLocationPermissions",
8085

8186
// animated
8287
"Animated",
8388

8489
// helpers
85-
"AnimatedPoint",
86-
"AnimatedCoordinatesArray",
87-
"AnimatedShape",
88-
"AnimatedExtractCoordinateFromArray",
89-
"AnimatedRouteCoordinatesArray",
90+
// "AnimatedPoint",
91+
// "AnimatedCoordinatesArray",
92+
// "AnimatedShape",
93+
// "AnimatedExtractCoordinateFromArray",
94+
// "AnimatedRouteCoordinatesArray",
9095
"Logger",
91-
"Style",
9296
];
93-
actualKeys.forEach((key) => expect(expectedKeys).toContain(key));
97+
98+
expect(actualKeys.sort()).toEqual(expectedKeys.sort());
9499
});
95100
});

jest-setup.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,13 @@ NativeModules.MLRNModule = {
7272
OfflinePackDownloadState: keyMirror(["Inactive", "Active", "Complete"]),
7373
OfflineCallbackName: keyMirror(["Progress", "Error"]),
7474

75-
// methods
75+
// Methods
7676
setAccessToken: jest.fn(),
7777
getAccessToken: () => Promise.resolve("test-token"),
78+
79+
addCustomHeader: jest.fn(),
80+
removeCustomHeader: jest.fn(),
81+
7882
setConnected: jest.fn(),
7983
};
8084

src/MLRNModule.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ interface IMLRNModule {
2929

3030
setAccessToken(accessToken: string | null): Promise<string | null>;
3131
getAccessToken(): Promise<string>;
32+
33+
addCustomHeader(headerName: string, headerValue: string): void;
34+
removeCustomHeader(headerName: string): void;
35+
3236
setConnected(connected: boolean): void;
3337
}
3438

@@ -40,7 +44,12 @@ export const {
4044
OfflinePackDownloadState,
4145
LineJoin,
4246
StyleSource,
47+
4348
setAccessToken,
4449
getAccessToken,
50+
51+
addCustomHeader,
52+
removeCustomHeader,
53+
4554
setConnected,
4655
} = MLRNModule;

0 commit comments

Comments
 (0)