Skip to content

Commit 00dbd81

Browse files
committed
update:增加测试用例
1 parent c94a438 commit 00dbd81

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Diff for: jstest/360test.js

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import * as drpy from '../libs/drpy.js';
2+
import path from 'path';
3+
import {fileURLToPath} from 'url';
4+
5+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
6+
7+
console.log('__dirname:', __dirname);
8+
9+
(async () => {
10+
// 使用 __dirname 来确保正确的相对路径,避免路径出错
11+
const modulePath = path.join(__dirname, '../js/360.js');
12+
13+
try {
14+
console.log('Initializing module...');
15+
const module = await drpy.init(modulePath); // 初始化模块
16+
17+
console.log('Calling home...');
18+
const result1 = await drpy.home(modulePath); // 调用 home 方法
19+
20+
console.log('Calling homeVod...');
21+
const result2 = await drpy.homeVod(modulePath); // 调用 homeVod 方法
22+
23+
console.log('Calling cate...');
24+
const result3 = await drpy.cate(modulePath); // 调用 cate 方法
25+
26+
console.log('Calling detail...');
27+
const result4 = await drpy.detail(modulePath); // 调用 detail 方法
28+
29+
console.log('Calling search...');
30+
const result5 = await drpy.search(modulePath); // 调用 search 方法
31+
32+
console.log('Calling play...');
33+
const result6 = await drpy.play(modulePath); // 调用 play 方法
34+
35+
console.log('Result1:', result1);
36+
console.log('Result2:', result2);
37+
console.log('Result3:', result3);
38+
console.log('Result4:', result4);
39+
console.log('Result5:', result5);
40+
console.log('Result6:', result6);
41+
} catch (error) {
42+
console.error('Error during module initialization or invocation:', error);
43+
}
44+
})();

0 commit comments

Comments
 (0)