@chainlesschain/personal-data-hub 0.4.28 → 0.4.30
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.
- package/README.md +13 -5
- package/lib/adapters/social-douyin-adb/usage-profile-reader.js +253 -0
- package/lib/adapters/social-douyin-adb/watch-history-reader.js +104 -31
- package/lib/adapters/social-toutiao-adb/article-reader.js +202 -0
- package/lib/analysis-skills/overview.js +24 -4
- package/lib/analysis-skills/spending.js +63 -2
- package/lib/analysis-skills/timeline.js +11 -6
- package/lib/prompt-builder.js +15 -1
- package/lib/query-parser.js +38 -8
- package/package.json +4 -1
- package/__tests__/adapter-guide.test.js +0 -47
- package/__tests__/adapter-spec.test.js +0 -78
- package/__tests__/adapters/ai-chat-cookie-capture-spec.test.js +0 -211
- package/__tests__/adapters/ai-chat-health-checker.test.js +0 -262
- package/__tests__/adapters/ai-chat-history.test.js +0 -396
- package/__tests__/adapters/ai-chat-http-client.test.js +0 -242
- package/__tests__/adapters/ai-chat-vendors.test.js +0 -874
- package/__tests__/adapters/alipay-bill-adapter.test.js +0 -538
- package/__tests__/adapters/apple-health.test.js +0 -95
- package/__tests__/adapters/bank-family.test.js +0 -125
- package/__tests__/adapters/biz-tianyancha.test.js +0 -159
- package/__tests__/adapters/browser-history-chrome.test.js +0 -377
- package/__tests__/adapters/browser-history-edge.test.js +0 -159
- package/__tests__/adapters/car-mercedesme.test.js +0 -74
- package/__tests__/adapters/doc-baidu-netdisk.test.js +0 -102
- package/__tests__/adapters/doc-camscanner.test.js +0 -147
- package/__tests__/adapters/doc-platforms.test.js +0 -177
- package/__tests__/adapters/edu-huawei-learning-live.test.js +0 -198
- package/__tests__/adapters/edu-zuoyebang-live.test.js +0 -226
- package/__tests__/adapters/email-adapter-snapshot.test.js +0 -237
- package/__tests__/adapters/email-adapter.test.js +0 -742
- package/__tests__/adapters/email-classifier.test.js +0 -347
- package/__tests__/adapters/email-imap-session.test.js +0 -334
- package/__tests__/adapters/email-parser.test.js +0 -244
- package/__tests__/adapters/email-pdf-extractor.test.js +0 -529
- package/__tests__/adapters/email-providers.test.js +0 -84
- package/__tests__/adapters/email-retry-progress.test.js +0 -294
- package/__tests__/adapters/email-templates.test.js +0 -822
- package/__tests__/adapters/family-23-collectors-scaffold.test.js +0 -182
- package/__tests__/adapters/finance-alipay-live.test.js +0 -258
- package/__tests__/adapters/finance-dcep.test.js +0 -74
- package/__tests__/adapters/fitness-joyrun.test.js +0 -82
- package/__tests__/adapters/game-genshin-live.test.js +0 -238
- package/__tests__/adapters/game-genshin-scaffold.test.js +0 -108
- package/__tests__/adapters/game-honor-of-kings-live.test.js +0 -230
- package/__tests__/adapters/git-activity.test.js +0 -222
- package/__tests__/adapters/gov-12123.test.js +0 -103
- package/__tests__/adapters/gov-ixiamen.test.js +0 -150
- package/__tests__/adapters/gov-tax.test.js +0 -135
- package/__tests__/adapters/health-meiyou.test.js +0 -125
- package/__tests__/adapters/local-files.test.js +0 -264
- package/__tests__/adapters/local-im-pc.test.js +0 -154
- package/__tests__/adapters/messaging-whatsapp.test.js +0 -289
- package/__tests__/adapters/music-kugou.test.js +0 -187
- package/__tests__/adapters/music-qq.test.js +0 -112
- package/__tests__/adapters/netease-music-live.test.js +0 -244
- package/__tests__/adapters/netease-music.test.js +0 -74
- package/__tests__/adapters/pc-local-discovery.test.js +0 -141
- package/__tests__/adapters/qq-pc-direct-read.test.js +0 -227
- package/__tests__/adapters/reading-family.test.js +0 -108
- package/__tests__/adapters/recruit-boss.test.js +0 -180
- package/__tests__/adapters/shell-history.test.js +0 -180
- package/__tests__/adapters/shopping-base.test.js +0 -179
- package/__tests__/adapters/shopping-dianping.test.js +0 -239
- package/__tests__/adapters/social-bilibili-adb-api-client.test.js +0 -721
- package/__tests__/adapters/social-bilibili-adb-chromium-cookies-reader.test.js +0 -346
- package/__tests__/adapters/social-bilibili-adb-collector.test.js +0 -284
- package/__tests__/adapters/social-bilibili-adb-cookies-extension.test.js +0 -343
- package/__tests__/adapters/social-bilibili-adb-snapshot-builder.test.js +0 -296
- package/__tests__/adapters/social-csdn.test.js +0 -175
- package/__tests__/adapters/social-dongchedi.test.js +0 -165
- package/__tests__/adapters/social-douyin-adb-aweme-detail.test.js +0 -165
- package/__tests__/adapters/social-douyin-adb-collector.test.js +0 -254
- package/__tests__/adapters/social-douyin-adb-db-extension.test.js +0 -114
- package/__tests__/adapters/social-douyin-adb-im-db-parser.test.js +0 -304
- package/__tests__/adapters/social-douyin-adb-snapshot-builder.test.js +0 -216
- package/__tests__/adapters/social-douyin-adb-watch-history.test.js +0 -192
- package/__tests__/adapters/social-kuaishou-adb-api-client.test.js +0 -496
- package/__tests__/adapters/social-kuaishou-adb-collector.test.js +0 -276
- package/__tests__/adapters/social-kuaishou-adb-cookies-extension.test.js +0 -152
- package/__tests__/adapters/social-kuaishou-adb-snapshot-builder.test.js +0 -178
- package/__tests__/adapters/social-toutiao-adb-account-reader.test.js +0 -135
- package/__tests__/adapters/social-toutiao-adb-api-client.test.js +0 -626
- package/__tests__/adapters/social-toutiao-adb-collector.test.js +0 -378
- package/__tests__/adapters/social-toutiao-adb-cookies-extension.test.js +0 -193
- package/__tests__/adapters/social-toutiao-adb-snapshot-builder.test.js +0 -196
- package/__tests__/adapters/social-toutiao-kuaishou-scaffold.test.js +0 -311
- package/__tests__/adapters/social-weibo-adb-api-client.test.js +0 -362
- package/__tests__/adapters/social-weibo-adb-collector.test.js +0 -201
- package/__tests__/adapters/social-weibo-adb-cookies-extension.test.js +0 -167
- package/__tests__/adapters/social-weibo-adb-snapshot-builder.test.js +0 -189
- package/__tests__/adapters/social-xiaohongshu-adb-api-client.test.js +0 -431
- package/__tests__/adapters/social-xiaohongshu-adb-collector.test.js +0 -207
- package/__tests__/adapters/social-xiaohongshu-adb-cookies-extension.test.js +0 -0
- package/__tests__/adapters/social-xiaohongshu-adb-sign-provider-injection.test.js +0 -351
- package/__tests__/adapters/social-xiaohongshu-adb-sign.test.js +0 -130
- package/__tests__/adapters/social-xiaohongshu-adb-snapshot-builder.test.js +0 -200
- package/__tests__/adapters/social-zhihu.test.js +0 -246
- package/__tests__/adapters/system-data-adapter.test.js +0 -443
- package/__tests__/adapters/system-data-android-ingest.test.js +0 -144
- package/__tests__/adapters/system-data-android.test.js +0 -519
- package/__tests__/adapters/system-data-disclosure.test.js +0 -153
- package/__tests__/adapters/travel-12306.test.js +0 -512
- package/__tests__/adapters/travel-amap.test.js +0 -219
- package/__tests__/adapters/travel-baidu-map.test.js +0 -305
- package/__tests__/adapters/travel-base.test.js +0 -205
- package/__tests__/adapters/travel-ctrip.test.js +0 -377
- package/__tests__/adapters/travel-didi-consumer.test.js +0 -66
- package/__tests__/adapters/travel-didi.test.js +0 -204
- package/__tests__/adapters/travel-tencent-map.test.js +0 -207
- package/__tests__/adapters/travel-tongcheng.test.js +0 -289
- package/__tests__/adapters/video-platforms.test.js +0 -152
- package/__tests__/adapters/video-xigua.test.js +0 -106
- package/__tests__/adapters/vscode.test.js +0 -299
- package/__tests__/adapters/wechat-bootstrap.test.js +0 -240
- package/__tests__/adapters/wechat-env-probe.test.js +0 -162
- package/__tests__/adapters/wechat-frida-agent.test.js +0 -322
- package/__tests__/adapters/wechat-frida-integration.test.js +0 -149
- package/__tests__/adapters/wechat-frida-key-provider.test.js +0 -188
- package/__tests__/adapters/wechat-md5-key-provider.test.js +0 -101
- package/__tests__/adapters/wechat-pc-direct-read.test.js +0 -365
- package/__tests__/adapters/wechat-pc-group-topic.test.js +0 -63
- package/__tests__/adapters/wechat-pc-v4-sidecar.test.js +0 -72
- package/__tests__/adapters/weread.test.js +0 -123
- package/__tests__/adapters/wework-pc.test.js +0 -124
- package/__tests__/adapters/win-recent.test.js +0 -192
- package/__tests__/analysis-skills.test.js +0 -679
- package/__tests__/analysis.test.js +0 -1845
- package/__tests__/audio-ximalaya-snapshot.test.js +0 -279
- package/__tests__/batch.test.js +0 -133
- package/__tests__/bridges-cc-kg.test.js +0 -231
- package/__tests__/bridges-cc-llm.test.js +0 -191
- package/__tests__/bridges-cc-rag.test.js +0 -162
- package/__tests__/categories.test.js +0 -92
- package/__tests__/e2e/ai-chat-cross-source-journey.test.js +0 -213
- package/__tests__/e2e/full-user-journey.test.js +0 -188
- package/__tests__/e2e/local-data-adapters-cli.e2e.test.js +0 -146
- package/__tests__/entity-resolver-ingest-hook.test.js +0 -177
- package/__tests__/entity-resolver-stages.test.js +0 -411
- package/__tests__/entity-resolver-vault.test.js +0 -249
- package/__tests__/entity-resolver.test.js +0 -526
- package/__tests__/fitness-keep-snapshot.test.js +0 -224
- package/__tests__/fixtures/entity-resolver-200-mock.json +0 -96
- package/__tests__/ids.test.js +0 -45
- package/__tests__/integration/ai-chat-history-registry.test.js +0 -228
- package/__tests__/integration/aichat-wizard-end-to-end.test.js +0 -282
- package/__tests__/integration/cross-adapter-pipelines.test.js +0 -396
- package/__tests__/integration/local-data-adapters-pipeline.test.js +0 -373
- package/__tests__/integration/social-bilibili-pipeline.test.js +0 -261
- package/__tests__/integration/wechat-bootstrap-end-to-end.test.js +0 -390
- package/__tests__/key-providers.test.js +0 -126
- package/__tests__/kg-derive.test.js +0 -219
- package/__tests__/llm-client.test.js +0 -122
- package/__tests__/longtail-adapters.test.js +0 -281
- package/__tests__/messaging-qq-snapshot.test.js +0 -294
- package/__tests__/mobile-extractor-encrypted.test.js +0 -460
- package/__tests__/mobile-extractor.test.js +0 -288
- package/__tests__/mock-adapter.test.js +0 -93
- package/__tests__/prompt-builder.test.js +0 -249
- package/__tests__/query-parser.test.js +0 -302
- package/__tests__/rag-derive.test.js +0 -169
- package/__tests__/registry-readiness.test.js +0 -292
- package/__tests__/registry.test.js +0 -420
- package/__tests__/salvage-ingest.test.js +0 -97
- package/__tests__/schemas.test.js +0 -331
- package/__tests__/shopping-adapters.test.js +0 -392
- package/__tests__/shopping-eleme-snapshot.test.js +0 -454
- package/__tests__/shopping-pinduoduo-snapshot.test.js +0 -484
- package/__tests__/shopping-snapshot.test.js +0 -438
- package/__tests__/shopping-vipshop-snapshot.test.js +0 -425
- package/__tests__/shopping-xianyu-snapshot.test.js +0 -451
- package/__tests__/sidecar-contacts-cross-validate.test.js +0 -186
- package/__tests__/sidecar-supervisor.test.js +0 -128
- package/__tests__/sign-providers.test.js +0 -62
- package/__tests__/social-adapters.test.js +0 -280
- package/__tests__/social-bilibili-snapshot.test.js +0 -278
- package/__tests__/social-douban-snapshot.test.js +0 -351
- package/__tests__/social-douyin-im-direct-read.test.js +0 -377
- package/__tests__/social-douyin-salvage-collector.test.js +0 -98
- package/__tests__/social-douyin-salvage-mapper.test.js +0 -90
- package/__tests__/social-douyin-snapshot.test.js +0 -256
- package/__tests__/social-kuaishou-snapshot.test.js +0 -362
- package/__tests__/social-toutiao-snapshot.test.js +0 -366
- package/__tests__/social-weibo-snapshot.test.js +0 -234
- package/__tests__/social-weibo-sqlite-device.test.js +0 -174
- package/__tests__/social-xiaohongshu-snapshot.test.js +0 -232
- package/__tests__/sqlite-leaf-salvage.test.js +0 -97
- package/__tests__/travel-adapters.test.js +0 -483
- package/__tests__/travel-maps-snapshot.test.js +0 -426
- package/__tests__/vault-driver-error.test.js +0 -74
- package/__tests__/vault-search-helpers.test.js +0 -104
- package/__tests__/vault-search.test.js +0 -423
- package/__tests__/vault.test.js +0 -767
- package/__tests__/wechat-adapter.test.js +0 -594
- package/__tests__/whatsapp-adapter.test.js +0 -138
- package/scripts/_make-fixture-all.js +0 -126
- package/scripts/_make-fixture-contacts.js +0 -84
- package/scripts/evaluate-entity-resolver.js +0 -213
- package/scripts/run-native-tests-sandbox.sh +0 -55
- package/scripts/smoke-phase-5-5.js +0 -196
- package/scripts/smoke-phase-5-7.js +0 -181
- package/scripts/smoke-system-data-contacts.js +0 -309
- package/scripts/smoke-system-data.js +0 -312
- package/vitest.config.js +0 -88
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { describe, it, expect, beforeEach } from "vitest";
|
|
4
|
-
|
|
5
|
-
const fs = require("node:fs");
|
|
6
|
-
const path = require("node:path");
|
|
7
|
-
const os = require("node:os");
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
DouyinAdapter,
|
|
11
|
-
SNAPSHOT_SCHEMA_VERSION,
|
|
12
|
-
VALID_SNAPSHOT_KINDS,
|
|
13
|
-
} = require("../lib/adapters/social-douyin");
|
|
14
|
-
const { validateBatch } = require("../lib/batch");
|
|
15
|
-
|
|
16
|
-
// §A8 v0.2 — Douyin snapshot mode tests, mirror of social-weibo-snapshot.
|
|
17
|
-
//
|
|
18
|
-
// Snapshot mode is in-APK Android cc reading JSON written by
|
|
19
|
-
// DouyinLocalCollector (WebView cookie + 1 endpoint `passport/account/info/v2/`
|
|
20
|
-
// that works without X-Bogus). v0.2 SURFACE = profile kind only;
|
|
21
|
-
// history/favourite/like kinds are reserved in VALID_SNAPSHOT_KINDS for v0.3
|
|
22
|
-
// (X-Bogus path).
|
|
23
|
-
|
|
24
|
-
function writeSnapshot(dir, snapshot) {
|
|
25
|
-
const p = path.join(dir, "social-douyin.json");
|
|
26
|
-
fs.writeFileSync(p, JSON.stringify(snapshot), "utf-8");
|
|
27
|
-
return p;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
describe("DouyinAdapter snapshot mode", () => {
|
|
31
|
-
let tmpDir;
|
|
32
|
-
beforeEach(() => {
|
|
33
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "douyin-snap-"));
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("exports SNAPSHOT_SCHEMA_VERSION = 1 + 6 VALID_SNAPSHOT_KINDS", () => {
|
|
37
|
-
expect(SNAPSHOT_SCHEMA_VERSION).toBe(1);
|
|
38
|
-
// Forward-compat list (lib index.js): profile/history/favourite/like from
|
|
39
|
-
// v0.2/v0.3, plus message/contact added in Phase 2a (3c5126401, _im.db pull).
|
|
40
|
-
expect(VALID_SNAPSHOT_KINDS).toEqual([
|
|
41
|
-
"profile",
|
|
42
|
-
"history",
|
|
43
|
-
"favourite",
|
|
44
|
-
"like",
|
|
45
|
-
"message",
|
|
46
|
-
"contact",
|
|
47
|
-
]);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("authenticate(inputPath) ok when readable", async () => {
|
|
51
|
-
const p = writeSnapshot(tmpDir, {
|
|
52
|
-
schemaVersion: 1,
|
|
53
|
-
snapshottedAt: Date.now(),
|
|
54
|
-
events: [],
|
|
55
|
-
});
|
|
56
|
-
const a = new DouyinAdapter();
|
|
57
|
-
const res = await a.authenticate({ inputPath: p });
|
|
58
|
-
expect(res.ok).toBe(true);
|
|
59
|
-
expect(res.mode).toBe("snapshot-file");
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("authenticate(inputPath) fails when path unreadable", async () => {
|
|
63
|
-
const a = new DouyinAdapter();
|
|
64
|
-
const res = await a.authenticate({ inputPath: path.join(tmpDir, "missing.json") });
|
|
65
|
-
expect(res.ok).toBe(false);
|
|
66
|
-
expect(res.reason).toBe("INPUT_PATH_UNREADABLE");
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("authenticate() with neither inputPath nor dbPath returns NO_INPUT", async () => {
|
|
70
|
-
const a = new DouyinAdapter();
|
|
71
|
-
const res = await a.authenticate({});
|
|
72
|
-
expect(res.ok).toBe(false);
|
|
73
|
-
expect(res.reason).toBe("NO_INPUT");
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it("rejects schemaVersion mismatch", async () => {
|
|
77
|
-
const p = writeSnapshot(tmpDir, {
|
|
78
|
-
schemaVersion: 99,
|
|
79
|
-
snapshottedAt: Date.now(),
|
|
80
|
-
events: [],
|
|
81
|
-
});
|
|
82
|
-
const a = new DouyinAdapter();
|
|
83
|
-
let threw = null;
|
|
84
|
-
try {
|
|
85
|
-
for await (const _r of a.sync({ inputPath: p })) { /* drain */ }
|
|
86
|
-
} catch (err) {
|
|
87
|
-
threw = err;
|
|
88
|
-
}
|
|
89
|
-
expect(threw).toBeTruthy();
|
|
90
|
-
expect(String(threw.message)).toMatch(/schemaVersion mismatch/);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it("empty events array yields nothing (no crash)", async () => {
|
|
94
|
-
const p = writeSnapshot(tmpDir, {
|
|
95
|
-
schemaVersion: 1,
|
|
96
|
-
snapshottedAt: Date.now(),
|
|
97
|
-
events: [],
|
|
98
|
-
});
|
|
99
|
-
const a = new DouyinAdapter();
|
|
100
|
-
const raws = [];
|
|
101
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
102
|
-
expect(raws.length).toBe(0);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it("profile event round-trips normalize cleanly", async () => {
|
|
106
|
-
const now = Date.now();
|
|
107
|
-
const p = writeSnapshot(tmpDir, {
|
|
108
|
-
schemaVersion: 1,
|
|
109
|
-
snapshottedAt: now,
|
|
110
|
-
account: {
|
|
111
|
-
secUid: "MS4wLjABAAAA_alice",
|
|
112
|
-
shortId: "12345678",
|
|
113
|
-
displayName: "alice",
|
|
114
|
-
},
|
|
115
|
-
events: [
|
|
116
|
-
{
|
|
117
|
-
kind: "profile",
|
|
118
|
-
id: "profile-MS4wLjABAAAA_alice",
|
|
119
|
-
capturedAt: now - 1000,
|
|
120
|
-
secUid: "MS4wLjABAAAA_alice",
|
|
121
|
-
shortId: "12345678",
|
|
122
|
-
nickname: "alice",
|
|
123
|
-
signature: "hello world",
|
|
124
|
-
followingCount: 100,
|
|
125
|
-
followerCount: 200,
|
|
126
|
-
awemeCount: 5,
|
|
127
|
-
favoritingCount: 30,
|
|
128
|
-
totalFavorited: 1500,
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
});
|
|
132
|
-
const a = new DouyinAdapter();
|
|
133
|
-
const raws = [];
|
|
134
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
135
|
-
expect(raws.length).toBe(1);
|
|
136
|
-
expect(raws[0].kind).toBe("profile");
|
|
137
|
-
expect(raws[0].originalId).toMatch(/^douyin:profile:/);
|
|
138
|
-
|
|
139
|
-
const batch = a.normalize(raws[0]);
|
|
140
|
-
expect(validateBatch(batch).valid).toBe(true);
|
|
141
|
-
// v0.2 emits a person record (self) not an event — repeated syncs
|
|
142
|
-
// dedupe on the same id.
|
|
143
|
-
expect(batch.events.length).toBe(0);
|
|
144
|
-
expect(batch.persons.length).toBe(1);
|
|
145
|
-
const person = batch.persons[0];
|
|
146
|
-
expect(person.id).toBe("person-douyin-MS4wLjABAAAA_alice");
|
|
147
|
-
expect(person.subtype).toBe("self");
|
|
148
|
-
expect(person.names).toEqual(["alice"]);
|
|
149
|
-
expect(person.identifiers["douyin-sec-uid"]).toEqual(["MS4wLjABAAAA_alice"]);
|
|
150
|
-
expect(person.identifiers["douyin-short-id"]).toEqual(["12345678"]);
|
|
151
|
-
expect(person.extra.platform).toBe("douyin");
|
|
152
|
-
expect(person.extra.signature).toBe("hello world");
|
|
153
|
-
expect(person.extra.followerCount).toBe(200);
|
|
154
|
-
expect(person.extra.awemeCount).toBe(5);
|
|
155
|
-
expect(person.extra.totalFavorited).toBe(1500);
|
|
156
|
-
expect(person.source.capturedBy).toBe("api");
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it("respects per-kind include opt-out", async () => {
|
|
160
|
-
const now = Date.now();
|
|
161
|
-
const p = writeSnapshot(tmpDir, {
|
|
162
|
-
schemaVersion: 1,
|
|
163
|
-
snapshottedAt: now,
|
|
164
|
-
events: [
|
|
165
|
-
{ kind: "profile", id: "profile-X", capturedAt: now, secUid: "X", nickname: "x" },
|
|
166
|
-
],
|
|
167
|
-
});
|
|
168
|
-
const a = new DouyinAdapter();
|
|
169
|
-
const raws = [];
|
|
170
|
-
for await (const r of a.sync({ inputPath: p, include: { profile: false } })) {
|
|
171
|
-
raws.push(r);
|
|
172
|
-
}
|
|
173
|
-
expect(raws.length).toBe(0);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it("respects opts.limit", async () => {
|
|
177
|
-
// v0.2 unlikely to emit more than 1 profile, but verify the gate is wired.
|
|
178
|
-
const now = Date.now();
|
|
179
|
-
const events = [
|
|
180
|
-
{ kind: "profile", id: "p1", capturedAt: now, secUid: "X1", nickname: "x1" },
|
|
181
|
-
// simulate forward-compat: a v0.3 snapshot with history events
|
|
182
|
-
{ kind: "history", id: "h1", capturedAt: now - 1000, awemeId: "A1", title: "t1" },
|
|
183
|
-
{ kind: "history", id: "h2", capturedAt: now - 2000, awemeId: "A2", title: "t2" },
|
|
184
|
-
];
|
|
185
|
-
const p = writeSnapshot(tmpDir, { schemaVersion: 1, snapshottedAt: now, events });
|
|
186
|
-
const a = new DouyinAdapter();
|
|
187
|
-
const raws = [];
|
|
188
|
-
for await (const r of a.sync({ inputPath: p, limit: 2 })) raws.push(r);
|
|
189
|
-
expect(raws.length).toBe(2);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
it("filters out unknown kinds (forward compat)", async () => {
|
|
193
|
-
const now = Date.now();
|
|
194
|
-
const p = writeSnapshot(tmpDir, {
|
|
195
|
-
schemaVersion: 1,
|
|
196
|
-
snapshottedAt: now,
|
|
197
|
-
events: [
|
|
198
|
-
{ kind: "profile", id: "p1", capturedAt: now, secUid: "X", nickname: "x" },
|
|
199
|
-
{ kind: "future-kind", id: "x", capturedAt: now },
|
|
200
|
-
{ kind: "search", id: "s", capturedAt: now }, // search is sqlite-only
|
|
201
|
-
],
|
|
202
|
-
});
|
|
203
|
-
const a = new DouyinAdapter();
|
|
204
|
-
const raws = [];
|
|
205
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
206
|
-
expect(raws.length).toBe(1);
|
|
207
|
-
expect(raws[0].kind).toBe("profile");
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
it("snapshottedAt fallback when event capturedAt missing", async () => {
|
|
211
|
-
const ts = 1700000000000;
|
|
212
|
-
const p = writeSnapshot(tmpDir, {
|
|
213
|
-
schemaVersion: 1,
|
|
214
|
-
snapshottedAt: ts,
|
|
215
|
-
events: [
|
|
216
|
-
{ kind: "profile", id: "p1", secUid: "X", nickname: "x" },
|
|
217
|
-
],
|
|
218
|
-
});
|
|
219
|
-
const a = new DouyinAdapter();
|
|
220
|
-
const raws = [];
|
|
221
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
222
|
-
expect(raws[0].capturedAt).toBe(ts);
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
it("v0.3 forward-compat: history events round-trip if a future snapshot ships them", async () => {
|
|
226
|
-
// The Kotlin LocalCollector won't emit these in v0.2, but the JS adapter
|
|
227
|
-
// already knows how to ingest them — so when v0.3 lands we won't have to
|
|
228
|
-
// bump SNAPSHOT_SCHEMA_VERSION.
|
|
229
|
-
const now = Date.now();
|
|
230
|
-
const p = writeSnapshot(tmpDir, {
|
|
231
|
-
schemaVersion: 1,
|
|
232
|
-
snapshottedAt: now,
|
|
233
|
-
events: [
|
|
234
|
-
{
|
|
235
|
-
kind: "history",
|
|
236
|
-
id: "history-A1",
|
|
237
|
-
capturedAt: now - 1000,
|
|
238
|
-
awemeId: "A1",
|
|
239
|
-
title: "future video",
|
|
240
|
-
author: "creator",
|
|
241
|
-
duration: 30,
|
|
242
|
-
},
|
|
243
|
-
],
|
|
244
|
-
});
|
|
245
|
-
const a = new DouyinAdapter();
|
|
246
|
-
const raws = [];
|
|
247
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
248
|
-
expect(raws.length).toBe(1);
|
|
249
|
-
expect(raws[0].kind).toBe("history");
|
|
250
|
-
const batch = a.normalize(raws[0]);
|
|
251
|
-
expect(validateBatch(batch).valid).toBe(true);
|
|
252
|
-
expect(batch.events[0].subtype).toBe("browse");
|
|
253
|
-
expect(batch.events[0].extra.awemeId).toBe("A1");
|
|
254
|
-
expect(batch.events[0].extra.duration).toBe(30);
|
|
255
|
-
});
|
|
256
|
-
});
|
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { describe, it, expect, beforeEach } from "vitest";
|
|
4
|
-
|
|
5
|
-
const fs = require("node:fs");
|
|
6
|
-
const path = require("node:path");
|
|
7
|
-
const os = require("node:os");
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
KuaishouAdapter,
|
|
11
|
-
SNAPSHOT_SCHEMA_VERSION,
|
|
12
|
-
VALID_SNAPSHOT_KINDS,
|
|
13
|
-
} = require("../lib/adapters/social-kuaishou");
|
|
14
|
-
const { validateBatch } = require("../lib/batch");
|
|
15
|
-
|
|
16
|
-
// §A8 v0.2 — Kuaishou snapshot mode tests, mirror of social-toutiao-snapshot.
|
|
17
|
-
// Snapshot mode reads JSON produced by the phone's KuaishouLocalCollector
|
|
18
|
-
// (root + SQLCipher decrypt of /data/data/com.smile.gifmaker/databases/).
|
|
19
|
-
|
|
20
|
-
function writeSnapshot(dir, snapshot) {
|
|
21
|
-
const p = path.join(dir, "social-kuaishou.json");
|
|
22
|
-
fs.writeFileSync(p, JSON.stringify(snapshot), "utf-8");
|
|
23
|
-
return p;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
describe("KuaishouAdapter snapshot mode", () => {
|
|
27
|
-
let tmpDir;
|
|
28
|
-
beforeEach(() => {
|
|
29
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "kuaishou-snap-"));
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("exports SNAPSHOT_SCHEMA_VERSION = 1 + 4 VALID_SNAPSHOT_KINDS (v0.2.1 adds profile)", () => {
|
|
33
|
-
expect(SNAPSHOT_SCHEMA_VERSION).toBe(1);
|
|
34
|
-
expect(VALID_SNAPSHOT_KINDS).toEqual([
|
|
35
|
-
"profile",
|
|
36
|
-
"watch",
|
|
37
|
-
"collect",
|
|
38
|
-
"search",
|
|
39
|
-
]);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("authenticate(inputPath) ok when readable", async () => {
|
|
43
|
-
const p = writeSnapshot(tmpDir, {
|
|
44
|
-
schemaVersion: 1,
|
|
45
|
-
snapshottedAt: Date.now(),
|
|
46
|
-
events: [],
|
|
47
|
-
});
|
|
48
|
-
const a = new KuaishouAdapter();
|
|
49
|
-
const res = await a.authenticate({ inputPath: p });
|
|
50
|
-
expect(res.ok).toBe(true);
|
|
51
|
-
expect(res.mode).toBe("snapshot-file");
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("authenticate(inputPath) fails when path unreadable", async () => {
|
|
55
|
-
const a = new KuaishouAdapter();
|
|
56
|
-
const res = await a.authenticate({
|
|
57
|
-
inputPath: path.join(tmpDir, "missing.json"),
|
|
58
|
-
});
|
|
59
|
-
expect(res.ok).toBe(false);
|
|
60
|
-
expect(res.reason).toBe("INPUT_PATH_UNREADABLE");
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it("authenticate() with neither inputPath nor dbPath returns NO_INPUT", async () => {
|
|
64
|
-
const a = new KuaishouAdapter();
|
|
65
|
-
const res = await a.authenticate({});
|
|
66
|
-
expect(res.ok).toBe(false);
|
|
67
|
-
expect(res.reason).toBe("NO_INPUT");
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it("authenticate() sqlite mode without account.uid returns NO_ACCOUNT_UID", async () => {
|
|
71
|
-
const a = new KuaishouAdapter({ dbPath: "/no/such/path.db" });
|
|
72
|
-
const res = await a.authenticate({});
|
|
73
|
-
expect(res.ok).toBe(false);
|
|
74
|
-
expect(res.reason).toBe("NO_ACCOUNT_UID");
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("rejects schemaVersion mismatch", async () => {
|
|
78
|
-
const p = writeSnapshot(tmpDir, {
|
|
79
|
-
schemaVersion: 99,
|
|
80
|
-
snapshottedAt: Date.now(),
|
|
81
|
-
events: [],
|
|
82
|
-
});
|
|
83
|
-
const a = new KuaishouAdapter();
|
|
84
|
-
let threw = null;
|
|
85
|
-
try {
|
|
86
|
-
for await (const _r of a.sync({ inputPath: p })) {
|
|
87
|
-
/* drain */
|
|
88
|
-
}
|
|
89
|
-
} catch (err) {
|
|
90
|
-
threw = err;
|
|
91
|
-
}
|
|
92
|
-
expect(threw).toBeTruthy();
|
|
93
|
-
expect(String(threw.message)).toMatch(/schemaVersion mismatch/);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it("empty events array yields nothing (no crash)", async () => {
|
|
97
|
-
const p = writeSnapshot(tmpDir, {
|
|
98
|
-
schemaVersion: 1,
|
|
99
|
-
snapshottedAt: Date.now(),
|
|
100
|
-
events: [],
|
|
101
|
-
});
|
|
102
|
-
const a = new KuaishouAdapter();
|
|
103
|
-
const raws = [];
|
|
104
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
105
|
-
expect(raws.length).toBe(0);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it("v0.2 profile event normalizes to person-self with kuaishou-uid identifier", async () => {
|
|
109
|
-
const now = Date.now();
|
|
110
|
-
const p = writeSnapshot(tmpDir, {
|
|
111
|
-
schemaVersion: 1,
|
|
112
|
-
snapshottedAt: now,
|
|
113
|
-
account: { uid: "77777", displayName: "alice" },
|
|
114
|
-
events: [
|
|
115
|
-
{
|
|
116
|
-
kind: "profile",
|
|
117
|
-
id: "profile-77777",
|
|
118
|
-
capturedAt: now - 500,
|
|
119
|
-
uid: "77777",
|
|
120
|
-
nickname: "alice",
|
|
121
|
-
kuaishouId: "alice_KS",
|
|
122
|
-
avatarUrl: "https://p.kuaishou.com/u/alice.jpg",
|
|
123
|
-
sex: "F",
|
|
124
|
-
city: "Shanghai",
|
|
125
|
-
constellation: "Libra",
|
|
126
|
-
description: "hi there",
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
});
|
|
130
|
-
const a = new KuaishouAdapter();
|
|
131
|
-
const raws = [];
|
|
132
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
133
|
-
expect(raws.length).toBe(1);
|
|
134
|
-
expect(raws[0].kind).toBe("profile");
|
|
135
|
-
expect(raws[0].originalId).toMatch(/^kuaishou:profile:/);
|
|
136
|
-
|
|
137
|
-
const batch = a.normalize(raws[0]);
|
|
138
|
-
expect(validateBatch(batch).valid).toBe(true);
|
|
139
|
-
expect(batch.events.length).toBe(0);
|
|
140
|
-
expect(batch.persons.length).toBe(1);
|
|
141
|
-
const person = batch.persons[0];
|
|
142
|
-
expect(person.id).toBe("person-kuaishou-77777");
|
|
143
|
-
expect(person.subtype).toBe("self");
|
|
144
|
-
expect(person.names).toEqual(["alice"]);
|
|
145
|
-
expect(person.identifiers["kuaishou-uid"]).toEqual(["77777"]);
|
|
146
|
-
expect(person.identifiers["kuaishou-id"]).toEqual(["alice_KS"]);
|
|
147
|
-
expect(person.extra.platform).toBe("kuaishou");
|
|
148
|
-
expect(person.extra.avatarUrl).toBe("https://p.kuaishou.com/u/alice.jpg");
|
|
149
|
-
expect(person.extra.sex).toBe("F");
|
|
150
|
-
expect(person.extra.city).toBe("Shanghai");
|
|
151
|
-
expect(person.extra.constellation).toBe("Libra");
|
|
152
|
-
expect(person.extra.description).toBe("hi there");
|
|
153
|
-
expect(person.source.capturedBy).toBe("api");
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it("watch event round-trips normalize cleanly (BROWSE subtype)", async () => {
|
|
157
|
-
const now = Date.now();
|
|
158
|
-
const p = writeSnapshot(tmpDir, {
|
|
159
|
-
schemaVersion: 1,
|
|
160
|
-
snapshottedAt: now,
|
|
161
|
-
account: { uid: "67890", displayName: "alice" },
|
|
162
|
-
events: [
|
|
163
|
-
{
|
|
164
|
-
kind: "watch",
|
|
165
|
-
id: "photo-p-1",
|
|
166
|
-
capturedAt: now - 1000,
|
|
167
|
-
photoId: "p-1",
|
|
168
|
-
caption: "搞笑视频",
|
|
169
|
-
duration: 30,
|
|
170
|
-
authorId: "u-author-1",
|
|
171
|
-
authorName: "UpA",
|
|
172
|
-
},
|
|
173
|
-
],
|
|
174
|
-
});
|
|
175
|
-
const a = new KuaishouAdapter();
|
|
176
|
-
const raws = [];
|
|
177
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
178
|
-
expect(raws.length).toBe(1);
|
|
179
|
-
expect(raws[0].kind).toBe("watch");
|
|
180
|
-
expect(raws[0].originalId).toMatch(/^kuaishou:watch:/);
|
|
181
|
-
|
|
182
|
-
const batch = a.normalize(raws[0]);
|
|
183
|
-
expect(validateBatch(batch).valid).toBe(true);
|
|
184
|
-
expect(batch.events[0].subtype).toBe("browse");
|
|
185
|
-
expect(batch.events[0].content.title).toBe("搞笑视频");
|
|
186
|
-
expect(batch.events[0].extra.photoId).toBe("p-1");
|
|
187
|
-
expect(batch.events[0].extra.duration).toBe(30);
|
|
188
|
-
expect(batch.events[0].extra.authorId).toBe("u-author-1");
|
|
189
|
-
expect(batch.events[0].extra.authorName).toBe("UpA");
|
|
190
|
-
expect(batch.events[0].extra.platform).toBe("kuaishou");
|
|
191
|
-
expect(batch.events[0].source.capturedBy).toBe("api");
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it("collect event round-trips normalize cleanly (LIKE subtype)", async () => {
|
|
195
|
-
const now = Date.now();
|
|
196
|
-
const p = writeSnapshot(tmpDir, {
|
|
197
|
-
schemaVersion: 1,
|
|
198
|
-
snapshottedAt: now,
|
|
199
|
-
events: [
|
|
200
|
-
{
|
|
201
|
-
kind: "collect",
|
|
202
|
-
id: "collect-p-2",
|
|
203
|
-
capturedAt: now - 2000,
|
|
204
|
-
photoId: "p-2",
|
|
205
|
-
caption: "美食 vlog",
|
|
206
|
-
authorId: "u-author-2",
|
|
207
|
-
authorName: "FoodVlogger",
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
|
-
});
|
|
211
|
-
const a = new KuaishouAdapter();
|
|
212
|
-
const raws = [];
|
|
213
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
214
|
-
expect(raws.length).toBe(1);
|
|
215
|
-
|
|
216
|
-
const batch = a.normalize(raws[0]);
|
|
217
|
-
expect(validateBatch(batch).valid).toBe(true);
|
|
218
|
-
expect(batch.events[0].subtype).toBe("like");
|
|
219
|
-
expect(batch.events[0].content.title).toBe("美食 vlog");
|
|
220
|
-
expect(batch.events[0].extra.photoId).toBe("p-2");
|
|
221
|
-
expect(batch.events[0].extra.authorName).toBe("FoodVlogger");
|
|
222
|
-
expect(batch.events[0].source.capturedBy).toBe("api");
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
it("search event round-trips normalize cleanly (POST subtype, keyword in title)", async () => {
|
|
226
|
-
const now = Date.now();
|
|
227
|
-
const p = writeSnapshot(tmpDir, {
|
|
228
|
-
schemaVersion: 1,
|
|
229
|
-
snapshottedAt: now,
|
|
230
|
-
events: [
|
|
231
|
-
{
|
|
232
|
-
kind: "search",
|
|
233
|
-
id: "search-square-dance:1700002000",
|
|
234
|
-
capturedAt: now - 3000,
|
|
235
|
-
keyword: "广场舞",
|
|
236
|
-
},
|
|
237
|
-
],
|
|
238
|
-
});
|
|
239
|
-
const a = new KuaishouAdapter();
|
|
240
|
-
const raws = [];
|
|
241
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
242
|
-
expect(raws.length).toBe(1);
|
|
243
|
-
|
|
244
|
-
const batch = a.normalize(raws[0]);
|
|
245
|
-
expect(validateBatch(batch).valid).toBe(true);
|
|
246
|
-
expect(batch.events[0].subtype).toBe("post");
|
|
247
|
-
expect(batch.events[0].content.title).toBe("广场舞");
|
|
248
|
-
expect(batch.events[0].extra.kind).toBe("search");
|
|
249
|
-
expect(batch.events[0].extra.keyword).toBe("广场舞");
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
it("respects per-kind include opt-out", async () => {
|
|
253
|
-
const now = Date.now();
|
|
254
|
-
const p = writeSnapshot(tmpDir, {
|
|
255
|
-
schemaVersion: 1,
|
|
256
|
-
snapshottedAt: now,
|
|
257
|
-
events: [
|
|
258
|
-
{ kind: "watch", id: "w1", capturedAt: now, photoId: "p-1", caption: "c1" },
|
|
259
|
-
{ kind: "collect", id: "c1", capturedAt: now, photoId: "p-2", caption: "c2" },
|
|
260
|
-
{ kind: "search", id: "s1", capturedAt: now, keyword: "kw" },
|
|
261
|
-
],
|
|
262
|
-
});
|
|
263
|
-
const a = new KuaishouAdapter();
|
|
264
|
-
const raws = [];
|
|
265
|
-
for await (const r of a.sync({
|
|
266
|
-
inputPath: p,
|
|
267
|
-
include: { collect: false, search: false },
|
|
268
|
-
})) {
|
|
269
|
-
raws.push(r);
|
|
270
|
-
}
|
|
271
|
-
expect(raws.length).toBe(1);
|
|
272
|
-
expect(raws[0].kind).toBe("watch");
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it("respects opts.limit", async () => {
|
|
276
|
-
const now = Date.now();
|
|
277
|
-
const events = [];
|
|
278
|
-
for (let i = 0; i < 10; i++) {
|
|
279
|
-
events.push({
|
|
280
|
-
kind: "watch",
|
|
281
|
-
id: `w${i}`,
|
|
282
|
-
capturedAt: now - i * 1000,
|
|
283
|
-
photoId: `p-${i}`,
|
|
284
|
-
caption: `c${i}`,
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
const p = writeSnapshot(tmpDir, { schemaVersion: 1, snapshottedAt: now, events });
|
|
288
|
-
const a = new KuaishouAdapter();
|
|
289
|
-
const raws = [];
|
|
290
|
-
for await (const r of a.sync({ inputPath: p, limit: 5 })) raws.push(r);
|
|
291
|
-
expect(raws.length).toBe(5);
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
it("filters out unknown kinds (forward compat)", async () => {
|
|
295
|
-
const now = Date.now();
|
|
296
|
-
const p = writeSnapshot(tmpDir, {
|
|
297
|
-
schemaVersion: 1,
|
|
298
|
-
snapshottedAt: now,
|
|
299
|
-
events: [
|
|
300
|
-
{ kind: "watch", id: "w1", capturedAt: now, photoId: "p-1", caption: "c1" },
|
|
301
|
-
{ kind: "future-kind", id: "x", capturedAt: now },
|
|
302
|
-
{ kind: "live-watch", id: "lv-1", capturedAt: now }, // v0.3 hypothetical
|
|
303
|
-
],
|
|
304
|
-
});
|
|
305
|
-
const a = new KuaishouAdapter();
|
|
306
|
-
const raws = [];
|
|
307
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
308
|
-
expect(raws.length).toBe(1);
|
|
309
|
-
expect(raws[0].kind).toBe("watch");
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
it("snapshottedAt fallback when event capturedAt missing", async () => {
|
|
313
|
-
const ts = 1700000000000;
|
|
314
|
-
const p = writeSnapshot(tmpDir, {
|
|
315
|
-
schemaVersion: 1,
|
|
316
|
-
snapshottedAt: ts,
|
|
317
|
-
events: [{ kind: "watch", id: "w1", photoId: "p-1", caption: "c1" }],
|
|
318
|
-
});
|
|
319
|
-
const a = new KuaishouAdapter();
|
|
320
|
-
const raws = [];
|
|
321
|
-
for await (const r of a.sync({ inputPath: p })) raws.push(r);
|
|
322
|
-
expect(raws[0].capturedAt).toBe(ts);
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
it("sqlite mode throws when account.uid missing at sync time", async () => {
|
|
326
|
-
const a = new KuaishouAdapter();
|
|
327
|
-
let threw = null;
|
|
328
|
-
try {
|
|
329
|
-
for await (const _r of a.sync({ dbPath: "/no/such/path.db" })) {
|
|
330
|
-
/* drain */
|
|
331
|
-
}
|
|
332
|
-
} catch (err) {
|
|
333
|
-
threw = err;
|
|
334
|
-
}
|
|
335
|
-
expect(threw).toBeTruthy();
|
|
336
|
-
expect(String(threw.message)).toMatch(/account\.uid required/);
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
it("sqlite mode gracefully exits when dbPath unreadable (with account.uid)", async () => {
|
|
340
|
-
const a = new KuaishouAdapter({
|
|
341
|
-
account: { uid: "u-2" },
|
|
342
|
-
dbPath: "/no/such/path.db",
|
|
343
|
-
});
|
|
344
|
-
const raws = [];
|
|
345
|
-
for await (const r of a.sync()) raws.push(r);
|
|
346
|
-
expect(raws).toEqual([]);
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
it("sync() with neither inputPath nor dbPath throws", async () => {
|
|
350
|
-
const a = new KuaishouAdapter();
|
|
351
|
-
let threw = null;
|
|
352
|
-
try {
|
|
353
|
-
for await (const _r of a.sync()) {
|
|
354
|
-
/* drain */
|
|
355
|
-
}
|
|
356
|
-
} catch (err) {
|
|
357
|
-
threw = err;
|
|
358
|
-
}
|
|
359
|
-
expect(threw).toBeTruthy();
|
|
360
|
-
expect(String(threw.message)).toMatch(/needs opts\.inputPath/);
|
|
361
|
-
});
|
|
362
|
-
});
|