Skip to content

Commit d9dc597

Browse files
test script updated.
1 parent 727ade7 commit d9dc597

File tree

4 files changed

+127
-12
lines changed

4 files changed

+127
-12
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "puddysql",
33
"description": "🍮 Powerful SQL toolkit for Node.js, built with flexibility and structure in mind. Easily manage SQLite3/PostgreSQL, advanced queries, smart tag systems, and full JSON-friendly filters.",
4-
"version": "1.0.0-beta-2",
4+
"version": "1.0.0-beta-3",
55
"main": "./dist/index.cjs",
66
"module": "./dist/index.mjs",
77
"types": "./dist/index.d.mts",
@@ -23,7 +23,7 @@
2323
"pg": "^8.16.3",
2424
"sqlite": "^5.1.1",
2525
"sqlite3": "^5.1.7",
26-
"tiny-essentials": "^1.22.1"
26+
"tiny-essentials": "^1.24.2"
2727
},
2828
"keywords": [
2929
"sql",

test/index.mjs

Lines changed: 117 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,56 @@ const db = new PuddySql.Instance();
109109

110110
const tagManager = tagTable.getTagEditor('tags');
111111

112-
await tagTable.set('a1', { title: 'Post 1', tags: ['cute', 'funny'] });
113-
await tagTable.set('a2', { title: 'Post 2', tags: ['serious'] });
114-
await tagTable.set('a3', { title: 'Post 3', tags: ['cute', 'deep'] });
112+
await tagTable.set('a1', {
113+
title: 'Post 1',
114+
tags: ['cute', 'funny', 'smiling', 'safe', 'pony', 'solo'],
115+
});
116+
117+
await tagTable.set('a2', {
118+
title: 'Post 2',
119+
tags: ['serious', 'portrait', 'grayscale', 'sad', 'moody', 'artistic'],
120+
});
121+
122+
await tagTable.set('a3', {
123+
title: 'Post 3',
124+
tags: ['cute', 'deep', 'friendship', 'heartwarming', 'sunset'],
125+
});
126+
127+
await tagTable.set('a4', {
128+
title: 'Post 4',
129+
tags: ['adventure', 'flying', 'rainbow', 'dynamic pose', 'epic'],
130+
});
131+
132+
await tagTable.set('a5', {
133+
title: 'Post 5',
134+
tags: ['comic', 'dialogue', 'cute', 'humor', 'slice of life', 'safe'],
135+
});
136+
137+
await tagTable.set('a6', {
138+
title: 'Post 6',
139+
tags: ['serious', 'cute', 'magic', 'sparkles', 'fantasy', 'unicorn', 'glow'],
140+
});
141+
142+
await tagTable.set('a7', {
143+
title: 'Post 7',
144+
tags: ['background pony', 'deep', 'crowd', 'event', 'festival', 'fun'],
145+
});
146+
147+
await tagTable.set('a8', {
148+
title: 'Post 8',
149+
tags: ['artist:jasmindreasond', 'digital art', 'soft shading', 'pastel colors', 'aesthetic'],
150+
});
151+
152+
await tagTable.set('a9', {
153+
title: 'Post 9',
154+
tags: ['meme', 'meta', 'fourth wall', 'funny', 'safe'],
155+
});
156+
157+
await tagTable.set('a10', {
158+
title: 'Post 10',
159+
tags: ['dark', 'night', 'stars', 'dream', 'mystery', 'atmospheric'],
160+
});
161+
115162
console.table(await tagTable.getAll());
116163

117164
console.log('\n🔖 \x1b[34mSearch: has tag "cute"\x1b[0m\n');
@@ -128,10 +175,59 @@ const db = new PuddySql.Instance();
128175
}),
129176
);
130177

178+
await tagTable.set('a11', { title: 'Sunny Morning', tags: ['cute', 'funny', 'smiling', 'safe'] });
179+
await tagTable.set('a12', { title: 'Deep Reflections', tags: ['deep', 'philosophy', 'serious'] });
180+
await tagTable.set('a13', {
181+
title: 'Friendly Hug',
182+
tags: ['cute', 'deep', 'heartwarming', 'safe'],
183+
});
184+
await tagTable.set('a14', {
185+
title: 'Stormy Night',
186+
tags: ['dark', 'mystery', 'deep', 'atmospheric'],
187+
});
188+
await tagTable.set('a15', {
189+
title: 'Comic Strip Fun',
190+
tags: ['comic', 'humor', 'funny', 'safe'],
191+
});
192+
await tagTable.set('a16', {
193+
title: 'Dreamy Meadow',
194+
tags: ['cute', 'pastel colors', 'peaceful'],
195+
});
196+
await tagTable.set('a17', { title: 'Ancient Wisdom', tags: ['deep', 'mythology', 'mystical'] });
197+
await tagTable.set('a18', {
198+
title: 'Digital Portrait',
199+
tags: ['artistic', 'portrait', 'soft shading'],
200+
});
201+
await tagTable.set('a19', {
202+
title: 'Festival of Lights',
203+
tags: ['celebration', 'crowd', 'fun', 'bright'],
204+
});
205+
await tagTable.set('a20', {
206+
title: 'Philosopher’s Gaze',
207+
tags: ['deep', 'serious', 'emotional'],
208+
});
209+
await tagTable.set('a21', {
210+
title: 'Cute Picnic',
211+
tags: ['cute', 'friends', 'outdoors', 'happy'],
212+
});
213+
await tagTable.set('a22', { title: 'Silent Library', tags: ['deep', 'quiet', 'mysterious'] });
214+
await tagTable.set('a23', { title: 'Sleepy Afternoon', tags: ['cute', 'relaxed', 'soft light'] });
215+
await tagTable.set('a24', { title: 'Galaxy Wonders', tags: ['space', 'stars', 'deep', 'awe'] });
216+
await tagTable.set('a25', {
217+
title: 'Breezy Fields',
218+
tags: ['cute', 'peaceful', 'safe', 'scenic'],
219+
});
220+
await tagTable.set('a26', { title: 'Tearful Goodbye', tags: ['deep', 'emotional', 'sad'] });
221+
await tagTable.set('a27', { title: 'Meme Magic', tags: ['meme', 'funny', 'meta', 'safe'] });
222+
await tagTable.set('a28', { title: 'Nighttime Thoughts', tags: ['deep', 'dream', 'melancholy'] });
223+
await tagTable.set('a29', { title: 'Happy Dance', tags: ['cute', 'funny', 'joy', 'safe'] });
224+
await tagTable.set('a30', { title: 'Old Photograph', tags: ['nostalgia', 'deep', 'monochrome'] });
225+
131226
console.log('\n⚡ \x1b[35mBoosted Tag Search (cute *2, deep *3)\x1b[0m\n');
132227
console.table(
133228
await tagTable.search({
134229
select: {
230+
values: ['*'],
135231
boost: {
136232
alias: 'p',
137233
value: [
@@ -144,6 +240,24 @@ const db = new PuddySql.Instance();
144240
}),
145241
);
146242

243+
console.log('\n⚡ \x1b[35mBoosted Tag Search (cute *2 OR deep *3)\x1b[0m\n');
244+
console.table(
245+
await tagTable.search({
246+
select: {
247+
values: ['*'],
248+
boost: {
249+
alias: 'p',
250+
value: [
251+
{ columns: ['tags'], value: 'deep', weight: 3 },
252+
{ columns: ['tags'], value: 'cute', weight: 2 },
253+
],
254+
},
255+
},
256+
tagsQ: { column: 'tags', include: [['cute', 'deep']] },
257+
order: 'p DESC',
258+
}),
259+
);
260+
147261
console.log('\n✅ \x1b[1;32mAll tag tests done.\x1b[0m');
148262
console.log('\n🎉 \x1b[1;32mDone. Everything looks delicious! 🍮\x1b[0m\n');
149263
})();

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"emitDeclarationOnly": false,
1010
"target": "ESNext",
1111
"strict": true,
12-
"moduleResolution": "node",
12+
"moduleResolution": "NodeNext",
13+
"module": "NodeNext",
1314
"allowSyntheticDefaultImports": true,
1415
"skipLibCheck": true,
1516
},

0 commit comments

Comments
 (0)