
- Complete NestJS TypeScript implementation with WebSocket support - Direct messaging (DM) and group chat functionality - End-to-end encryption with AES encryption and key pairs - Media file support (images, videos, audio, documents) up to 100MB - Push notifications with Firebase Cloud Messaging integration - Mention alerts and real-time typing indicators - User authentication with JWT and Passport - SQLite database with TypeORM entities and relationships - Comprehensive API documentation with Swagger/OpenAPI - File upload handling with secure access control - Online/offline status tracking and presence management - Message editing, deletion, and reply functionality - Notification management with automatic cleanup - Health check endpoint for monitoring - CORS configuration for cross-origin requests - Environment-based configuration management - Structured for Flutter SDK integration Features implemented: ✅ Real-time messaging with Socket.IO ✅ User registration and authentication ✅ Direct messages and group chats ✅ Media file uploads and management ✅ End-to-end encryption ✅ Push notifications ✅ Mention alerts ✅ Typing indicators ✅ Message read receipts ✅ Online status tracking ✅ File access control ✅ Comprehensive API documentation Ready for Flutter SDK development and production deployment.
104 lines
2.3 KiB
JavaScript
104 lines
2.3 KiB
JavaScript
var test = require("tape")
|
|
var extend = require("./")
|
|
var mutableExtend = require("./mutable")
|
|
|
|
test("merge", function(assert) {
|
|
var a = { a: "foo" }
|
|
var b = { b: "bar" }
|
|
|
|
assert.deepEqual(extend(a, b), { a: "foo", b: "bar" })
|
|
assert.end()
|
|
})
|
|
|
|
test("replace", function(assert) {
|
|
var a = { a: "foo" }
|
|
var b = { a: "bar" }
|
|
|
|
assert.deepEqual(extend(a, b), { a: "bar" })
|
|
assert.end()
|
|
})
|
|
|
|
test("undefined", function(assert) {
|
|
var a = { a: undefined }
|
|
var b = { b: "foo" }
|
|
|
|
assert.deepEqual(extend(a, b), { a: undefined, b: "foo" })
|
|
assert.deepEqual(extend(b, a), { a: undefined, b: "foo" })
|
|
assert.end()
|
|
})
|
|
|
|
test("handle 0", function(assert) {
|
|
var a = { a: "default" }
|
|
var b = { a: 0 }
|
|
|
|
assert.deepEqual(extend(a, b), { a: 0 })
|
|
assert.deepEqual(extend(b, a), { a: "default" })
|
|
assert.end()
|
|
})
|
|
|
|
test("is immutable", function (assert) {
|
|
var record = {}
|
|
|
|
extend(record, { foo: "bar" })
|
|
assert.equal(record.foo, undefined)
|
|
assert.end()
|
|
})
|
|
|
|
test("null as argument", function (assert) {
|
|
var a = { foo: "bar" }
|
|
var b = null
|
|
var c = void 0
|
|
|
|
assert.deepEqual(extend(b, a, c), { foo: "bar" })
|
|
assert.end()
|
|
})
|
|
|
|
test("mutable", function (assert) {
|
|
var a = { foo: "bar" }
|
|
|
|
mutableExtend(a, { bar: "baz" })
|
|
|
|
assert.equal(a.bar, "baz")
|
|
assert.end()
|
|
})
|
|
|
|
test("null prototype", function(assert) {
|
|
var a = { a: "foo" }
|
|
var b = Object.create(null)
|
|
b.b = "bar";
|
|
|
|
assert.deepEqual(extend(a, b), { a: "foo", b: "bar" })
|
|
assert.end()
|
|
})
|
|
|
|
test("null prototype mutable", function (assert) {
|
|
var a = { foo: "bar" }
|
|
var b = Object.create(null)
|
|
b.bar = "baz";
|
|
|
|
mutableExtend(a, b)
|
|
|
|
assert.equal(a.bar, "baz")
|
|
assert.end()
|
|
})
|
|
|
|
test("prototype pollution", function (assert) {
|
|
var a = {}
|
|
var maliciousPayload = '{"__proto__":{"oops":"It works!"}}'
|
|
|
|
assert.strictEqual(a.oops, undefined)
|
|
extend({}, maliciousPayload)
|
|
assert.strictEqual(a.oops, undefined)
|
|
assert.end()
|
|
})
|
|
|
|
test("prototype pollution mutable", function (assert) {
|
|
var a = {}
|
|
var maliciousPayload = '{"__proto__":{"oops":"It works!"}}'
|
|
|
|
assert.strictEqual(a.oops, undefined)
|
|
mutableExtend({}, maliciousPayload)
|
|
assert.strictEqual(a.oops, undefined)
|
|
assert.end()
|
|
})
|