noho-platform 1.0.2 → 1.0.4
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/gitignore +4 -0
- package/noho-dashboard.html +670 -314
- package/package.json +7 -6
- package/test-lib.js +0 -56
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "noho-platform",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"author": "",
|
|
8
|
+
"type": "commonjs",
|
|
5
9
|
"main": "index.js",
|
|
6
10
|
"scripts": {
|
|
7
11
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
12
|
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"type": "commonjs",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"cors": "^2.8.6",
|
|
15
15
|
"express": "^5.2.1",
|
|
@@ -18,5 +18,6 @@
|
|
|
18
18
|
"node-fetch": "^3.3.2",
|
|
19
19
|
"noho-platform": "^1.0.0",
|
|
20
20
|
"ws": "^8.19.0"
|
|
21
|
-
}
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {}
|
|
22
23
|
}
|
package/test-lib.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const NOHOLibrary = require('./noho-lib');
|
|
2
|
-
|
|
3
|
-
async function test() {
|
|
4
|
-
console.log('🧪 Testing NOHO Library...\n');
|
|
5
|
-
|
|
6
|
-
const lib = new NOHOLibrary({
|
|
7
|
-
aiKey: 'test-key',
|
|
8
|
-
dbPath: './test_data'
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
// انتظر التهيئة
|
|
12
|
-
await new Promise(r => setTimeout(r, 500));
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
// 1. اختبار التسجيل
|
|
16
|
-
console.log('1️⃣ Testing register...');
|
|
17
|
-
const user = await lib.registerUser('ahmed@test.com', '12345678', 'ahmed');
|
|
18
|
-
console.log('✅ User created:', user.username);
|
|
19
|
-
console.log(' API Key:', user.apiKey.substring(0, 20) + '...');
|
|
20
|
-
|
|
21
|
-
// 2. اختبار تسجيل الدخول
|
|
22
|
-
console.log('\n2️⃣ Testing login...');
|
|
23
|
-
const login = await lib.loginUser('ahmed@test.com', '12345678');
|
|
24
|
-
console.log('✅ Login successful, token:', login.token.substring(0, 20) + '...');
|
|
25
|
-
|
|
26
|
-
// 3. اختبار إنشاء صفحة
|
|
27
|
-
console.log('\n3️⃣ Testing create page...');
|
|
28
|
-
const page = await lib.createPage(
|
|
29
|
-
user.userId,
|
|
30
|
-
'/hello',
|
|
31
|
-
'res.send("<h1>Hello from NOHO!</h1>")',
|
|
32
|
-
{ public: true }
|
|
33
|
-
);
|
|
34
|
-
console.log('✅ Page created:', page.route);
|
|
35
|
-
console.log(' ID:', page.id);
|
|
36
|
-
|
|
37
|
-
// 4. اختبار استرجاع الصفحة
|
|
38
|
-
console.log('\n4️⃣ Testing get page...');
|
|
39
|
-
const found = lib.getPageByRoute('/ahmed/hello');
|
|
40
|
-
console.log('✅ Page found:', found ? 'YES' : 'NO');
|
|
41
|
-
console.log(' Views:', found.stats.views);
|
|
42
|
-
|
|
43
|
-
// 5. اختبار الإحصائيات
|
|
44
|
-
console.log('\n5️⃣ Testing stats...');
|
|
45
|
-
const stats = lib.getUserStats(user.userId);
|
|
46
|
-
console.log('✅ Stats:', JSON.stringify(stats, null, 2));
|
|
47
|
-
|
|
48
|
-
console.log('\n🎉 All tests passed!');
|
|
49
|
-
|
|
50
|
-
} catch (error) {
|
|
51
|
-
console.error('\n❌ Test failed:', error.message);
|
|
52
|
-
console.error(error.stack);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
test();
|