1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
//! Shared constants and helpers for CLI integration tests.
//!
//! Centralizes all hardcoded values so they can be changed in one place
//! and easily varied for broader coverage. Each constant is named by
//! its semantic purpose, not its numeric value.
//!
//! Note: `#[allow(dead_code)]` is needed because each test binary only
//! imports a subset of these constants.
use Command;
// ============================================================
// API keys
// ============================================================
/// Dummy API key used for argument-parsing tests (not a real key).
pub const TEST_API_KEY: &str = "test";
// ============================================================
// Provider names
// ============================================================
pub const PROVIDER_HERE: &str = "here";
pub const PROVIDER_GOOGLE: &str = "google";
pub const PROVIDER_TOMTOM: &str = "tomtom";
pub const PROVIDER_MAPBOX: &str = "mapbox";
pub const PROVIDER_RADAR: &str = "radar";
/// All supported provider names — useful for iteration.
pub const ALL_PROVIDERS: & = &;
// ============================================================
// Geographic coordinates
// ============================================================
/// Berlin (Brandenburg Gate area) — primary test coordinate.
pub const BERLIN_LAT: &str = "52.5";
pub const BERLIN_LNG: &str = "13.3";
/// Combined "lat,lng" for route/tour arguments.
pub const BERLIN_COORDS: &str = "52.5,13.3";
/// Second point near Berlin — used in traces, multi-stop tours.
pub const BERLIN2_COORDS: &str = "52.6,13.4";
/// Paris — used as route destination.
pub const PARIS_COORDS: &str = "48.8,2.3";
/// New York City — test coordinate with correct negative longitude.
pub const NYC_LAT: &str = "40.71";
pub const NYC_LNG: &str = "-74.01";
pub const NYC_COORDS: &str = "40.71,-74.01";
/// NYC with positive lng — for `--lng` flag tests that don't use `=` syntax.
/// Geographically wrong but avoids CLI negative-arg parsing issues for simple tests.
pub const NYC_LAT_POSLNG: &str = "40.71";
pub const NYC_LNG_POS: &str = "74.0";
/// Boston — used as route destination.
pub const BOSTON_COORDS: &str = "42.36,-71.06";
// ============================================================
// Bounding boxes
// ============================================================
/// Berlin area bounding box (south,west;north,east).
pub const BERLIN_BBOX: &str = "52.4,13.2;52.6,13.5";
// ============================================================
// Tile coordinates (HERE Vector Tile API v2 tiling scheme)
// ============================================================
/// Berlin area at zoom 14 in HERE's own tiling scheme.
pub const HERE_TILE_Z: &str = "14";
pub const HERE_TILE_X: &str = "4494";
pub const HERE_TILE_Y: &str = "2832";
/// Standard web Mercator tile coords (Slippy map, used by TomTom/MapBox).
pub const TILE_Z: &str = "14";
pub const TILE_X: &str = "8800";
pub const TILE_Y: &str = "5374";
// ============================================================
// Query strings
// ============================================================
pub const QUERY_BERLIN: &str = "Berlin";
pub const QUERY_NYC: &str = "New York";
// ============================================================
// Trace strings
// ============================================================
/// Standard 2-point trace near Berlin.
pub const TRACE_BERLIN: &str = "52.5,13.3;52.6,13.4";
/// 2-point trace near NYC (correct negative longitudes).
pub const TRACE_NYC: &str = "40.71,-74.01;40.72,-74.00";
// ============================================================
// Transport modes
// ============================================================
pub const TRANSPORT_CAR: &str = "car";
// ============================================================
// CLI helpers
// ============================================================
/// Create a CLI `Command` for the everymap binary.
/// Build a base CLI command with `--api-key` set to the test dummy key.
///
/// Use this for most tests that need to get past the "API key required" check.
/// Build a CLI command with `EVERYMAP_API_KEY` env var removed.
///
/// Use this for tests that verify the "API key required" error path.
/// Removes the env var that clap reads for `--api-key` so the CLI
/// actually sees a missing key.
/// Build a CLI command with no API key available from any source.
///
/// Removes `EVERYMAP_API_KEY` env var and sets `HOME` to a temp directory
/// so `~/.everymap/config.toml` won't be found. This forces the
/// "API key required" error path.
// ============================================================
// Predicate / assertion string constants
// ============================================================
/// Stderr substring when a domain is not available for a provider.
pub const ERR_NOT_SUPPORTED: &str = "not supported by this provider";
/// Stderr substring prefix for unsupported domain stubs.
/// Use with format!: `format!("{} does not support {}", provider, domain)`
pub const ERR_DOES_NOT_SUPPORT_PREFIX: &str = "does not support";
/// Stderr substring when provider name is invalid.
pub const ERR_UNSUPPORTED_PROVIDER: &str = "Unsupported provider";
/// Stderr substring when API key is missing.
pub const ERR_API_KEY_REQUIRED: &str = "API key required";
/// Build the "provider does not support domain" error string.