Skip to content

Commit d38506e

Browse files
committed
feat: US-193 - Add ioredis project-matrix fixture
1 parent 66ec71a commit d38506e

4 files changed

Lines changed: 87 additions & 0 deletions

File tree

docs/nodejs-compatibility.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ The [project-matrix test suite](https://github.com/rivet-dev/secure-exec/tree/ma
7878
| [ssh2-sftp-client](https://npmjs.com/package/ssh2-sftp-client) | Networking | SFTP client, file transfer APIs over SSH |
7979
| [pg](https://npmjs.com/package/pg) | Database | PostgreSQL client, Pool/Client classes, type parsers |
8080
| [mysql2](https://npmjs.com/package/mysql2) | Database | MySQL client, connection/pool classes, escape/format utilities |
81+
| [ioredis](https://npmjs.com/package/ioredis) | Database | Redis client, Cluster, Command, pipeline/multi transaction APIs |
8182
| [drizzle-orm](https://npmjs.com/package/drizzle-orm) | Database | ORM schema definition, query building, ESM module graph |
8283
| [ws](https://npmjs.com/package/ws) | Networking | WebSocket client/server, HTTP upgrade, events |
8384
| [jsonwebtoken](https://npmjs.com/package/jsonwebtoken) | Crypto | JWT signing (HS256), verification, decode |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"entry": "src/index.js",
3+
"expectation": "pass"
4+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "project-matrix-ioredis-pass",
3+
"private": true,
4+
"type": "commonjs",
5+
"dependencies": {
6+
"ioredis": "5.4.2"
7+
}
8+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
"use strict";
2+
3+
var Redis = require("ioredis");
4+
5+
var result = {};
6+
7+
// Verify Redis constructor
8+
result.redisExists = typeof Redis === "function";
9+
10+
// Verify key prototype methods
11+
result.instanceMethods = [
12+
"connect",
13+
"disconnect",
14+
"quit",
15+
"get",
16+
"set",
17+
"del",
18+
"lpush",
19+
"lrange",
20+
"subscribe",
21+
"unsubscribe",
22+
"publish",
23+
"pipeline",
24+
"multi",
25+
].filter(function (m) {
26+
return typeof Redis.prototype[m] === "function";
27+
});
28+
29+
// Verify Cluster class
30+
result.clusterExists = typeof Redis.Cluster === "function";
31+
32+
// Verify Command class
33+
result.commandExists = typeof Redis.Command === "function";
34+
35+
// Create instance without connecting
36+
var redis = new Redis({
37+
lazyConnect: true,
38+
enableReadyCheck: false,
39+
retryStrategy: function () {
40+
return null;
41+
},
42+
});
43+
result.instanceCreated = redis instanceof Redis;
44+
result.hasOptions = typeof redis.options === "object" && redis.options !== null;
45+
result.optionLazyConnect = redis.options.lazyConnect === true;
46+
47+
// Event emitter functionality
48+
result.hasOn = typeof redis.on === "function";
49+
result.hasEmit = typeof redis.emit === "function";
50+
51+
// Pipeline creation (no connection needed)
52+
var pipeline = redis.pipeline();
53+
result.pipelineCreated = pipeline !== null && typeof pipeline === "object";
54+
result.pipelineMethods = ["set", "get", "del", "lpush", "lrange", "exec"].filter(
55+
function (m) {
56+
return typeof pipeline[m] === "function";
57+
},
58+
);
59+
60+
// Multi/transaction creation (no connection needed)
61+
var multi = redis.multi();
62+
result.multiCreated = multi !== null && typeof multi === "object";
63+
result.multiMethods = ["set", "get", "del", "exec"].filter(function (m) {
64+
return typeof multi[m] === "function";
65+
});
66+
67+
// Verify Command can build commands
68+
var cmd = new Redis.Command("SET", ["key", "value"]);
69+
result.commandBuilt = cmd !== null && typeof cmd === "object";
70+
result.commandName = cmd.name;
71+
72+
redis.disconnect();
73+
74+
console.log(JSON.stringify(result));

0 commit comments

Comments
 (0)