@aiking/bridge-jtg5122 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,84 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import {
4
+ FREQ_CABLE,
5
+ FREQ_SUSP,
6
+ gradeCol,
7
+ OVERVIEW,
8
+ THRESHOLDS,
9
+ CABLE_INSPECT_INTERVAL,
10
+ RUST_GRADE_51,
11
+ RUST_GRADE_C,
12
+ REPLACE_CABLE,
13
+ REPLACE_SUSP,
14
+ SPECIAL_TRIGGERS,
15
+ MAINTENANCE,
16
+ } from '../lib/data.js';
17
+
18
+ test('斜拉桥频率矩阵:15 个部件、4 档', () => {
19
+ assert.equal(FREQ_CABLE.length, 15);
20
+ for (const r of FREQ_CABLE) assert.equal(r.f.length, 4);
21
+ });
22
+
23
+ test('悬索桥频率矩阵:16 个部件、4 档', () => {
24
+ assert.equal(FREQ_SUSP.length, 16);
25
+ for (const r of FREQ_SUSP) assert.equal(r.f.length, 4);
26
+ });
27
+
28
+ test('等级列:1/2/3 类各列,4 与 5 类同列', () => {
29
+ assert.equal(gradeCol(1), 0);
30
+ assert.equal(gradeCol(3), 2);
31
+ assert.equal(gradeCol(4), 3);
32
+ assert.equal(gradeCol(5), 3);
33
+ assert.throws(() => gradeCol(0), /1~5/);
34
+ });
35
+
36
+ test('斜拉索锚头:1 类 4 月/次,4 类 1 月/次', () => {
37
+ const row = FREQ_CABLE.find((r) => r.item === '拉索上锚头');
38
+ assert.equal(row.f[0], '1 次/6 月');
39
+ assert.equal(row.f[3], '1 次/月');
40
+ });
41
+
42
+ test('悬索桥缆体 Ⅲ 恒为 4 次/月', () => {
43
+ const row = FREQ_SUSP.find((r) => r.item === '缆体 Ⅲ');
44
+ assert.ok(row.f.every((x) => x === '4 次/月'));
45
+ });
46
+
47
+ test('频率总览 9 项、含循环抽检 30%/3 年', () => {
48
+ assert.equal(OVERVIEW.length, 9);
49
+ assert.ok(OVERVIEW.some((o) => o.rule.includes('30%')));
50
+ });
51
+
52
+ test('关键阈值:螺杆 70%、除湿 50%、8 年、50% 换丝', () => {
53
+ const t = (k) => THRESHOLDS.find((x) => x.item.includes(k));
54
+ assert.match(t('索夹螺杆紧固力').value, /70%/);
55
+ assert.match(t('内部相对湿度').value, /50%/);
56
+ assert.match(t('全面修复').value, /8 年/);
57
+ assert.match(t('局部换丝').value, /50%/);
58
+ assert.equal(THRESHOLDS.length, 11);
59
+ });
60
+
61
+ test('主缆内部检查间隔 7 档,含断丝 5 年与 >10% 小于 5 年', () => {
62
+ assert.equal(CABLE_INSPECT_INTERVAL.length, 7);
63
+ assert.equal(CABLE_INSPECT_INTERVAL.find((c) => c.condition.includes('断丝')).interval, '5 年');
64
+ assert.match(CABLE_INSPECT_INTERVAL.find((c) => c.condition.includes('10%')).interval, /小于 5 年/);
65
+ });
66
+
67
+ test('两套锈蚀分级:表 5-1 为 8 级,附录 C 为 4 级', () => {
68
+ assert.equal(RUST_GRADE_51.length, 8);
69
+ assert.equal(RUST_GRADE_C.length, 4);
70
+ assert.match(RUST_GRADE_51[7].d, /80%/);
71
+ });
72
+
73
+ test('换索 7 条、吊索 5 条、特殊检查 3 条', () => {
74
+ assert.equal(REPLACE_CABLE.length, 7);
75
+ assert.equal(REPLACE_SUSP.length, 5);
76
+ assert.equal(SPECIAL_TRIGGERS.length, 3);
77
+ assert.match(REPLACE_CABLE[4], /设计使用寿命/);
78
+ });
79
+
80
+ test('养护对策 1~5 类齐全', () => {
81
+ assert.equal(Object.keys(MAINTENANCE).length, 5);
82
+ assert.ok(MAINTENANCE[5].includes('应急养护'));
83
+ assert.ok(MAINTENANCE[1].includes('预防养护'));
84
+ });