{"library":"parse-mockdb","title":"Parse SDK Mocked Database","description":"parse-mockdb provides a mocked RESTController for the Parse JavaScript SDK, specifically compatible with version `2.0+`. It is primarily designed for unit testing Parse-dependent applications by allowing developers to simulate Parse backend operations (CRUD, queries, relations) locally without requiring an actual Parse Server instance. The current stable version is 0.4.0, which targets Parse JS SDK 2.x. While it supports many core Parse features like basic CRUD, various query operators (e.g., $exists, $in, $regex), and Parse.Relation, it currently lacks support for Parse class-level permissions, ACLs, and special classes like Parse.User or Parse.Role. The release cadence appears to be driven by breaking changes and updates to align with the Parse SDK, with significant breaking changes in versions 0.3.0 and 0.4.0.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install parse-mockdb"],"cli":null},"imports":["const ParseMockDB = require('parse-mockdb');","ParseMockDB.mockDB(Parse);","const Parse = require('parse-shim');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"'use strict';\nconst Parse = require('parse-shim');\nconst ParseMockDB = require('parse-mockdb');\n\n// Initialize Parse (e.g., required for some SDK operations)\nParse.initialize('appId', 'jsKey', 'masterKey');\nParse.serverURL = 'http://localhost:1337/parse'; // Or any placeholder\n\nParseMockDB.mockDB(Parse); // Mock the Parse RESTController\n\n// Perform saves, queries, updates, deletes, etc... using the Parse JS SDK\nasync function testParseOperations() {\n  const MyObject = Parse.Object.extend('MyObject');\n  const myObject = new MyObject();\n  myObject.set('key', 'value');\n  await myObject.save();\n  console.log('Object saved with id:', myObject.id);\n\n  const query = new Parse.Query(MyObject);\n  query.equalTo('key', 'value');\n  const results = await query.find();\n  console.log('Found objects:', results.length);\n}\n\ntestParseOperations().then(() => {\n  ParseMockDB.cleanUp(); // Clear the Database\n  ParseMockDB.unMockDB(); // Un-mock the Parse RESTController\n  console.log('MockDB cleaned up and un-mocked.');\n});","lang":"javascript","description":"This quickstart demonstrates how to set up `parse-mockdb`, mock the Parse SDK, perform basic CRUD operations, and then clean up the mock database. It highlights the typical workflow for unit testing Parse applications.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}