seer-core 0.52.3

Core library for Seer domain name utilities
Documentation
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
//! Parser for .jp domains (JPRS format).
//!
//! JPRS uses a unique format where fields are prefixed with a letter code
//! followed by a Japanese label in brackets. Nameservers use the key
//! `p. [ネームサーバ]`.
//!
//! Example JPRS response:
//! ```text
//! Domain Information: [ドメイン情報]
//! a. [ドメイン名]                 TOKYO.JP
//! f. [組織名]                     東京ドメイン
//! g. [Organization]               Tokyo Domain
//! p. [ネームサーバ]               a.dns.jp
//! p. [ネームサーバ]               b.dns.jp
//! [状態]                          Reserved
//! [最終更新]                      2005/03/30 17:37:52 (JST)
//! ```

use chrono::{DateTime, Utc};
use regex::Regex;

use super::{push_bounded, MAX_NAMESERVERS, MAX_STATUSES};
use crate::whois::parser::{parse_fixed_offset_date, WhoisResponse};

static_regex! {
    /// Matches nameserver lines in both the legacy lettered format
    /// (`p. [ネームサーバ]   value`) and the current bracket-only format
    /// (`[Name Server]   value` / `[ネームサーバ]   value`).
    NS_PATTERN = r"(?m)^(?:p\.[ \t]+\[ネームサーバ\]|\[(?:Name Server|ネームサーバ)\])[ \t]+(.+)$";

    /// Matches organization (English): `g. [Organization]   value`
    ORG_PATTERN = r"(?m)^g\.[ \t]+\[Organization\][ \t]+(.+)$";

    /// Matches organization (Japanese): `f. [組織名]   value`
    ORG_JP_PATTERN = r"(?m)^f\.[ \t]+\[組織名\][ \t]+(.+)$";

    /// Matches state: `[状態]   value` / `[Status]   value` / `[State]   value`
    STATUS_PATTERN = r"(?m)^\[(?:状態|Status|State)\][ \t]+(.+)$";

    /// Matches last updated: `[最終更新]` / `[Last Updated]` (general-use .jp) /
    /// `[Last Update]` (attribute-type co.jp, or.jp, ne.jp, ac.jp, go.jp, …)
    ///   YYYY/MM/DD HH:MM:SS (JST)
    UPDATED_PATTERN = r"(?m)^\[(?:最終更新|Last Updated?)\][ \t]+(.+)$";

    /// Matches creation date: `[登録年月日]` / `[接続年月日]` / `[Created on]`
    /// (general-use .jp) and `[Registered Date]` / `[Connected Date]`
    /// (attribute-type co.jp etc.)   YYYY/MM/DD
    CREATED_PATTERN =
        r"(?m)^\[(?:登録年月日|接続年月日|Created on|Registered Date|Connected Date)\][ \t]+(.+)$";

    /// Matches expiration date: `[有効期限]` / `[Expires on]`   YYYY/MM/DD
    EXPIRES_PATTERN = r"(?m)^\[(?:有効期限|Expires on)\][ \t]+(.+)$";

    /// Matches DNSSEC signing key line, lettered `s. [署名鍵]` / `s. [Signing Key]`
    /// (the latter is what attribute-type co.jp etc. print under `/e`) or current
    /// `[Signing Key]` / `[署名鍵]`. The value portion is optional — an empty
    /// value means unsigned. Uses `[^\S\n]*` instead of `\s*` to avoid matching
    /// across newlines in multiline mode.
    SIGNING_KEY_LINE = r"(?m)^(?:s\.[ \t]+)?\[(?:Signing Key|署名鍵)\][^\S\n]*(.+)?$";

    /// Attribute-type domains (co.jp, or.jp, …) carry their expiry inside the
    /// state value: `[State]   Connected (2027/03/31)`.
    STATE_EXPIRY_PATTERN = r"\((\d{4}/\d{1,2}/\d{1,2})\)";

    /// Matches registrant lines in the current bracket format: prefer the English
    /// `[Registrant]` value; fall back to the Japanese `[登録者名]`.
    REGISTRANT_EN_PATTERN = r"(?m)^\[Registrant\][ \t]+(.+)$";
    REGISTRANT_JP_PATTERN = r"(?m)^\[登録者名\][ \t]+(.+)$";

    // Also support the English-appended format (when /e is used)
    /// Matches `Name Server:   value` and the `p.`-prefixed form. For the `p.`
    /// branch an optional bracketed label (e.g. `[Name Server]`) is consumed but
    /// not captured, so only the trailing hostname lands in the capture group —
    /// otherwise a `p. [label] host` line yields `[label] host` as the nameserver.
    NS_EN_PATTERN = r"(?im)^(?:Name Server[ \t]*:?|p\.[ \t]*(?:\[[^\]]*\])?)[ \t]+(.+)$";
}

/// TLDs this parser handles.
pub(super) const TLDS: &[&str] = &["jp"];

/// Parses .jp domains using the JPRS format.
pub(super) fn parse(domain: &str, server: &str, raw: &str) -> WhoisResponse {
    let mut nameservers = Vec::new();
    let mut organization = None;
    let mut status = Vec::new();
    let mut has_signing_key = false;

    // Extract nameservers (Japanese format)
    for caps in NS_PATTERN.captures_iter(raw) {
        if let Some(m) = caps.get(1) {
            let ns = m.as_str().trim().to_lowercase();
            push_bounded(&mut nameservers, ns, MAX_NAMESERVERS);
        }
    }

    // If no Japanese-format NS found, try English format
    // (some .jp responses use "Name Server:" style after /e suffix)
    if nameservers.is_empty() {
        for caps in NS_EN_PATTERN.captures_iter(raw) {
            if let Some(m) = caps.get(1) {
                let ns = m.as_str().trim().to_lowercase();
                push_bounded(&mut nameservers, ns, MAX_NAMESERVERS);
            }
        }
    }

    // Extract organization (prefer English, fall back to Japanese)
    if let Some(caps) = ORG_PATTERN.captures(raw) {
        if let Some(m) = caps.get(1) {
            let org = m.as_str().trim().to_string();
            if !org.is_empty() {
                organization = Some(org);
            }
        }
    }
    if organization.is_none() {
        if let Some(caps) = ORG_JP_PATTERN.captures(raw) {
            if let Some(m) = caps.get(1) {
                let org = m.as_str().trim().to_string();
                if !org.is_empty() {
                    organization = Some(org);
                }
            }
        }
    }
    // Current bracket format: [Registrant] (English) / [登録者名] (Japanese)
    for pattern in [&REGISTRANT_EN_PATTERN, &REGISTRANT_JP_PATTERN] {
        if organization.is_some() {
            break;
        }
        if let Some(caps) = pattern.captures(raw) {
            if let Some(m) = caps.get(1) {
                let org = m.as_str().trim().to_string();
                if !org.is_empty() {
                    organization = Some(org);
                }
            }
        }
    }

    // Extract status
    if let Some(caps) = STATUS_PATTERN.captures(raw) {
        if let Some(m) = caps.get(1) {
            let s = m.as_str().trim().to_string();
            push_bounded(&mut status, s, MAX_STATUSES);
        }
    }

    // Extract dates (first occurrence of the label that parses, so an
    // empty `[Registered Date]` falls through to `[Connected Date]`).
    let first_date = |pattern: &Regex| {
        pattern
            .captures_iter(raw)
            .filter_map(|caps| caps.get(1))
            .find_map(|m| parse_jprs_date(m.as_str()))
    };
    let updated_date = first_date(&UPDATED_PATTERN);
    let creation_date = first_date(&CREATED_PATTERN);
    let expiration_date = first_date(&EXPIRES_PATTERN).or_else(|| {
        status.iter().find_map(|s| {
            STATE_EXPIRY_PATTERN
                .captures(s)
                .and_then(|caps| caps.get(1))
                .and_then(|m| parse_jprs_date(m.as_str()))
        })
    });

    // DNSSEC — check if signing key has an actual value
    if let Some(caps) = SIGNING_KEY_LINE.captures(raw) {
        if let Some(m) = caps.get(1) {
            if !m.as_str().trim().is_empty() {
                has_signing_key = true;
            }
        }
    }

    // Only claim JPRS identity fields when the response actually carried
    // registration data. Synthesizing them onto a "No match!!" response
    // would trip is_available()'s registered-data guard, making
    // unregistered .jp domains impossible to report as available.
    let has_data = organization.is_some()
        || !nameservers.is_empty()
        || creation_date.is_some()
        || expiration_date.is_some()
        || !status.is_empty();

    WhoisResponse {
        domain: domain.to_string(),
        registrar: has_data.then(|| "JPRS".to_string()),
        registrant: organization.clone(),
        organization,
        registrant_country: has_data.then(|| "JP".to_string()),
        creation_date,
        expiration_date,
        updated_date,
        nameservers,
        status,
        dnssec: if has_signing_key {
            Some("signedDelegation".to_string())
        } else {
            None
        },
        whois_server: server.to_string(),
        raw_response: raw.to_string(),
        ..Default::default()
    }
}

fn parse_jprs_date(date_str: &str) -> Option<DateTime<Utc>> {
    // JPRS uses "YYYY/MM/DD HH:MM:SS (JST)" or "YYYY/MM/DD"; JST is UTC+9.
    let cleaned = date_str.trim().trim_end_matches("(JST)");
    parse_fixed_offset_date(cleaned, "%Y/%m/%d", 9)
}

#[cfg(test)]
mod tests {
    use super::*;
    use chrono::NaiveDateTime;

    const SAMPLE_JPRS_RESPONSE: &str = r#"[ JPRS database provides information on network administration. Its use is    ]
[ restricted to network administration purposes. For further information,     ]
[ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e'     ]
[ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'.                 ]
Domain Information: [ドメイン情報]
a. [ドメイン名]                 TOKYO.JP
e. [そしきめい]
f. [組織名]                     東京ドメイン
g. [Organization]               Tokyo Domain
k. [組織種別]
l. [Organization Type]
m. [登録担当者]
n. [技術連絡担当者]
p. [ネームサーバ]               a.dns.jp
p. [ネームサーバ]               b.dns.jp
p. [ネームサーバ]               c.dns.jp
p. [ネームサーバ]               d.dns.jp
p. [ネームサーバ]               e.dns.jp
p. [ネームサーバ]               f.dns.jp
p. [ネームサーバ]               g.dns.jp
p. [ネームサーバ]               h.dns.jp
s. [署名鍵]
[状態]                          Reserved
[登録年月日]
[接続年月日]
[最終更新]                      2005/03/30 17:37:52 (JST)"#;

    const SAMPLE_JPRS_DOMAIN: &str = r#"[ JPRS database provides information on network administration. Its use is    ]
Domain Information: [ドメイン情報]
a. [ドメイン名]                 EXAMPLE.JP
f. [組織名]                     株式会社エグザンプル
g. [Organization]               Example Inc.
p. [ネームサーバ]               ns1.example.jp
p. [ネームサーバ]               ns2.example.jp
s. [署名鍵]
[状態]                          Active
[登録年月日]                    2001/03/22
[接続年月日]                    2001/03/22
[最終更新]                      2024/04/01 01:05:10 (JST)"#;

    #[test]
    fn test_jprs_nameservers() {
        let result = parse("tokyo.jp", "whois.jprs.jp", SAMPLE_JPRS_RESPONSE);

        assert_eq!(result.nameservers.len(), 8);
        assert!(result.nameservers.contains(&"a.dns.jp".to_string()));
        assert!(result.nameservers.contains(&"h.dns.jp".to_string()));
    }

    #[test]
    fn test_jprs_organization() {
        let result = parse("tokyo.jp", "whois.jprs.jp", SAMPLE_JPRS_RESPONSE);

        assert_eq!(result.organization, Some("Tokyo Domain".to_string()));
    }

    #[test]
    fn test_jprs_status() {
        let result = parse("tokyo.jp", "whois.jprs.jp", SAMPLE_JPRS_RESPONSE);

        assert!(result.status.contains(&"Reserved".to_string()));
    }

    #[test]
    fn test_jprs_updated_date() {
        let result = parse("tokyo.jp", "whois.jprs.jp", SAMPLE_JPRS_RESPONSE);

        assert!(result.updated_date.is_some());
    }

    #[test]
    fn test_jprs_domain_with_dates() {
        let result = parse("example.jp", "whois.jprs.jp", SAMPLE_JPRS_DOMAIN);

        assert_eq!(result.nameservers.len(), 2);
        assert!(result.nameservers.contains(&"ns1.example.jp".to_string()));
        assert!(result.nameservers.contains(&"ns2.example.jp".to_string()));
        assert_eq!(result.organization, Some("Example Inc.".to_string()));
        assert!(result.status.contains(&"Active".to_string()));
        assert!(result.creation_date.is_some());
        assert!(result.updated_date.is_some());
    }

    #[test]
    fn test_jprs_no_signing_key() {
        let result = parse("tokyo.jp", "whois.jprs.jp", SAMPLE_JPRS_RESPONSE);

        // s. [署名鍵] is empty, so no DNSSEC
        assert!(result.dnssec.is_none());
    }

    /// English-appended (/e) variant whose NS lines carry a `p.` prefix and a
    /// bracketed label that is NOT the exact Japanese `[ネームサーバ]`. The strict
    /// Japanese NS_PATTERN doesn't match, so parsing falls back to NS_EN_PATTERN.
    /// That fallback must extract only the hostname, not swallow the bracket
    /// label into the nameserver value.
    const SAMPLE_JPRS_EN_BRACKET_NS: &str = r#"Domain Information:
a. [Domain Name]                EXAMPLE.JP
p.        [Name Server]              a.dns.jp
p.        [Name Server]              b.dns.jp
[State]                         Active"#;

    #[test]
    fn test_jprs_en_fallback_strips_bracket_label() {
        let result = parse("example.jp", "whois.jprs.jp", SAMPLE_JPRS_EN_BRACKET_NS);

        assert_eq!(
            result.nameservers,
            vec!["a.dns.jp".to_string(), "b.dns.jp".to_string()],
            "fallback must capture only the hostname, not the bracket label"
        );
    }

    /// Current JPRS format (captured live 2026-07): bracket labels with NO
    /// letter prefixes — `[Name Server]`, Japanese date labels, and an expiry
    /// field `[有効期限]` that JPRS now publishes.
    const SAMPLE_JPRS_CURRENT: &str = r#"[ JPRS database provides information on network administration. Its use is    ]
Domain Information: [ドメイン情報]
[Domain Name]                   JPRS.JP

[登録者名]                      株式会社日本レジストリサービス
[Registrant]                    Japan Registry Services Co.,Ltd.

[Name Server]                   ns1.jprs.jp
[Name Server]                   ns2.jprs.jp
[Name Server]                   ns3.jprs.jp
[Name Server]                   ns4.jprs.jp
[Signing Key]                   7240 8 2 (
                                E147A85589E24FE0DBB5980C73501B5D
                                D656BE5550714F150BE574AE8777B77D )

[登録年月日]                    2001/02/02
[有効期限]                      2027/02/28
[状態]                          Active
[最終更新]                      2026/03/01 01:05:03 (JST)"#;

    /// Same record queried with the `/e` suffix: English-only labels.
    const SAMPLE_JPRS_CURRENT_EN: &str = r#"Domain Information:
[Domain Name]                   JPRS.JP

[Registrant]                    Japan Registry Services Co.,Ltd.

[Name Server]                   ns1.jprs.jp
[Name Server]                   ns2.jprs.jp
[Signing Key]                   7240 8 2 (
                                E147A85589E24FE0DBB5980C73501B5D )

[Created on]                    2001/02/02
[Expires on]                    2027/02/28
[Status]                        Active
[Last Updated]                  2026/03/01 01:05:03 (JST)"#;

    #[test]
    fn test_jprs_current_format_nameservers_and_dates() {
        let result = parse("jprs.jp", "whois.jprs.jp", SAMPLE_JPRS_CURRENT);

        assert_eq!(
            result.nameservers,
            vec!["ns1.jprs.jp", "ns2.jprs.jp", "ns3.jprs.jp", "ns4.jprs.jp"]
        );
        assert!(result.creation_date.is_some(), "created from [登録年月日]");
        assert!(result.expiration_date.is_some(), "expiry from [有効期限]");
        assert!(result.status.contains(&"Active".to_string()));
        assert_eq!(
            result.organization.as_deref(),
            Some("Japan Registry Services Co.,Ltd.")
        );
        assert_eq!(result.dnssec.as_deref(), Some("signedDelegation"));
    }

    /// Unregistered .jp: JPRS answers "No match!!". The parser must not
    /// hardcode registrar/country onto a no-match response — a synthesized
    /// registrar makes `is_available()` bail via its registered-data guard,
    /// so unregistered .jp domains could never be reported available.
    #[test]
    fn test_jprs_no_match_is_available() {
        let raw = "[ JPRS database provides information on network administration. Its use is    ]\n\
                   [ restricted to network administration purposes. For further information,     ]\n\
                   No match!!\n";
        let result = parse("nosuchdomain.jp", "whois.jprs.jp", raw);
        assert!(
            result.registrar.is_none(),
            "no-match must not synthesize a registrar"
        );
        assert!(
            result.is_available(),
            "No match!! must mark the domain available"
        );
    }

    #[test]
    fn test_jprs_current_format_english_labels() {
        let result = parse("jprs.jp", "whois.jprs.jp", SAMPLE_JPRS_CURRENT_EN);

        assert_eq!(result.nameservers, vec!["ns1.jprs.jp", "ns2.jprs.jp"]);
        assert!(result.creation_date.is_some(), "created from [Created on]");
        assert!(result.expiration_date.is_some(), "expiry from [Expires on]");
        assert!(result.status.contains(&"Active".to_string()));
        assert_eq!(result.dnssec.as_deref(), Some("signedDelegation"));
    }

    /// An EMPTY bracket field must not capture the next line: `\s+` after
    /// the label used to match the line break, turning an empty
    /// `p. [Name Server]` into the nameserver `s. [signing key]`.
    #[test]
    fn test_jprs_empty_fields_do_not_capture_next_line() {
        let raw = "Domain Information:\n\
                   a. [Domain Name]                EXAMPLE.CO.JP\n\
                   g. [Organization]               \n\
                   l. [Organization Type]          Company\n\
                   p. [Name Server]                \n\
                   s. [Signing Key]                \n\
                   [State]                         Connected (2027/03/31)\n";
        let result = parse("example.co.jp", "whois.jprs.jp", raw);
        assert!(
            result.nameservers.is_empty(),
            "empty NS line must not yield the next line: {:?}",
            result.nameservers
        );
        assert_eq!(
            result.organization, None,
            "empty [Organization] must not capture [Organization Type]"
        );
    }

    /// Attribute-type .jp (co.jp, or.jp, ne.jp, ac.jp, go.jp …) queried with
    /// `/e`: dates are `[Registered Date]` / `[Connected Date]` /
    /// `[Last Update]`, the signing key is `s. [Signing Key]`, and the expiry
    /// is carried in the state value `Connected (YYYY/MM/DD)`.
    const SAMPLE_JPRS_CO_JP_EN: &str = "\
[ JPRS database provides information on network administration. Its use is    ]
[ restricted to network administration purposes. For further information,     ]
[ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e'     ]
[ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'.                 ]

Domain Information:
a. [Domain Name]                GOOGLE.CO.JP
g. [Organization]               Google Japan G.K.
l. [Organization Type]          Limited Liability Company
m. [Administrative Contact]     DL152JP
n. [Technical Contact]          TW124137JP
p. [Name Server]                ns1.google.com
p. [Name Server]                ns2.google.com
p. [Name Server]                ns3.google.com
p. [Name Server]                ns4.google.com
s. [Signing Key]                \n\
[State]                         Connected (2027/03/31)
[Lock Status]                   DomainTransferLocked
[Lock Status]                   AgentChangeLocked
[Registered Date]               2001/03/22
[Connected Date]                2001/03/22
[Last Update]                   2026/04/01 01:05:10 (JST)
";

    #[test]
    fn test_jprs_attribute_type_co_jp_labels() {
        use chrono::{Datelike, Timelike};
        let result = parse("google.co.jp", "whois.jprs.jp", SAMPLE_JPRS_CO_JP_EN);

        assert_eq!(
            result.nameservers,
            vec![
                "ns1.google.com",
                "ns2.google.com",
                "ns3.google.com",
                "ns4.google.com"
            ]
        );
        assert_eq!(result.organization.as_deref(), Some("Google Japan G.K."));
        let created = result
            .creation_date
            .expect("created from [Registered Date]");
        assert_eq!(
            (created.year(), created.month(), created.day()),
            (2001, 3, 22)
        );
        let updated = result.updated_date.expect("updated from [Last Update]");
        // 01:05:10 JST == 16:05:10 UTC the previous day.
        assert_eq!(
            (updated.month(), updated.day(), updated.hour()),
            (3, 31, 16),
            "JST must be converted to UTC"
        );
        let expires = result
            .expiration_date
            .expect("expiry from the Connected (YYYY/MM/DD) state");
        assert_eq!(
            (expires.year(), expires.month(), expires.day()),
            (2027, 3, 31)
        );
        assert_eq!(
            result.dnssec, None,
            "an empty s. [Signing Key] means unsigned"
        );

        // A populated `s. [Signing Key]` line marks the zone as signed.
        let signed = SAMPLE_JPRS_CO_JP_EN.replace(
            "s. [Signing Key]                \n",
            "s. [Signing Key]                12345 8 2 ABCDEF0123456789\n",
        );
        assert_ne!(signed, SAMPLE_JPRS_CO_JP_EN, "fixture replacement applied");
        let result = parse("google.co.jp", "whois.jprs.jp", &signed);
        assert_eq!(result.dnssec.as_deref(), Some("signedDelegation"));
    }

    /// A hostile / on-path server (port 43 is plaintext) can send a date at
    /// chrono's lower bound; subtracting the JST offset must not underflow
    /// and panic — the date is simply dropped.
    #[test]
    fn test_jprs_date_at_chrono_min_does_not_panic() {
        let min = NaiveDateTime::MIN.format("%Y/%m/%d %H:%M:%S").to_string();
        assert!(
            NaiveDateTime::parse_from_str(&min, "%Y/%m/%d %H:%M:%S").is_ok(),
            "fixture must reach the JST-offset subtraction: {min}"
        );
        assert_eq!(parse_jprs_date(&format!("{min} (JST)")), None);

        let raw = format!(
            "Domain Information:\n\
             [Domain Name]                   EXAMPLE.JP\n\
             [Name Server]                   ns1.example.jp\n\
             [Last Updated]                  {min} (JST)\n"
        );
        let result = parse("example.jp", "whois.jprs.jp", &raw);
        assert_eq!(result.updated_date, None);
        assert_eq!(result.nameservers, vec!["ns1.example.jp"]);
    }
}