{"id":13800997,"url":"https://github.com/BlinkUX/sequelize-mock","last_synced_at":"2025-05-13T10:30:51.848Z","repository":{"id":11695129,"uuid":"70278773","full_name":"BlinkUX/sequelize-mock","owner":"BlinkUX","description":"A simple mock interface specifically for testing code relying on Sequelize models","archived":false,"fork":false,"pushed_at":"2023-07-21T18:55:28.000Z","size":239,"stargazers_count":137,"open_issues_count":53,"forks_count":73,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-05-23T02:03:05.549Z","etag":null,"topics":["mock-models","sequelize","sequelize-models","unit-testing"],"latest_commit_sha":null,"homepage":"https://sequelize-mock.readthedocs.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlinkUX.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-10-07T20:00:44.000Z","updated_at":"2024-04-08T00:19:00.000Z","dependencies_parsed_at":"2023-01-13T16:37:24.304Z","dependency_job_id":null,"html_url":"https://github.com/BlinkUX/sequelize-mock","commit_stats":{"total_commits":164,"total_committers":12,"mean_commits":"13.666666666666666","dds":0.1707317073170732,"last_synced_commit":"2db72e5ce3e8d630cb93ed1814000627c31e5590"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlinkUX%2Fsequelize-mock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlinkUX%2Fsequelize-mock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlinkUX%2Fsequelize-mock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlinkUX%2Fsequelize-mock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlinkUX","download_url":"https://codeload.github.com/BlinkUX/sequelize-mock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224362256,"owners_count":17298672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mock-models","sequelize","sequelize-models","unit-testing"],"created_at":"2024-08-04T00:01:18.396Z","updated_at":"2024-11-18T15:31:26.431Z","avatar_url":"https://github.com/BlinkUX.png","language":"JavaScript","readme":"# Sequelize Mock\n[![npm](https://img.shields.io/npm/v/sequelize-mock.svg)](https://www.npmjs.com/package/sequelize-mock) [![CircleCI](https://img.shields.io/circleci/project/BlinkUX/sequelize-mock.svg)](https://circleci.com/gh/BlinkUX/sequelize-mock) [![Coveralls](https://img.shields.io/coveralls/BlinkUX/sequelize-mock.svg)](https://coveralls.io/github/BlinkUX/sequelize-mock) [![MIT License](https://img.shields.io/github/license/BlinkUX/sequelize-mock.svg)](https://github.com/BlinkUX/sequelize-mock) [![Documentation Status](https://readthedocs.org/projects/sequelize-mock/badge/?version=stable)](http://sequelize-mock.readthedocs.io/en/stable/?badge=stable)\n\nA mocking interface designed for testing code that uses [Sequelize](http://sequelizejs.com).\n\nDocumentation at [sequelize-mock.readthedocs.io](https://sequelize-mock.readthedocs.io/)\n\n## Install\n\n```\nnpm i sequelize-mock --save-dev\n```\n\n## Getting Started\n\nThe Mock Models created with this library function as drop in replacements for your unit testing.\n\nStart by importing the library\n\n```javascript\nvar SequelizeMock = require('sequelize-mock');\n```\n\nInitialize the library as you would Sequelize\n\n```javascript\nvar DBConnectionMock = new SequelizeMock();\n```\n\nDefine your models\n\n```javascript\nvar UserMock = DBConnectionMock.define('users', {\n\t\t'email': 'email@example.com',\n\t\t'username': 'blink',\n\t\t'picture': 'user-picture.jpg',\n\t}, {\n\t\tinstanceMethods: {\n\t\t\tmyTestFunc: function () {\n\t\t\t\treturn 'Test User';\n\t\t\t},\n\t\t},\n\t});\n```\n\nOnce Mock models have been defined, you can use them as drop-in replacements for your Sequelize model objects. Data is not retrieved from a database and instead is returned based on the setup of the mock objects, the query being made, and other applied or included information.\n\nFor example, your code might look something like this\n\n```javascript\nUserMock.findOne({\n\twhere: {\n\t\tusername: 'my-user',\n\t},\n}).then(function (user) {\n\t// `user` is a Sequelize Model-like object\n\tuser.get('id');         // Auto-Incrementing ID available on all Models\n\tuser.get('email');      // 'email@example.com'; Pulled from default values\n\tuser.get('username');   // 'my-user'; Pulled from the `where` in the query\n\t\n\tuser.myTestFunc();      // Will return 'Test User' as defined above\n});\n```\n\n## Contributing\n\nThis library is under active development, so you should feel free to submit issues, questions, or pull requests.\n\n## License\n\nCreated by Blink UX and licensed under the MIT license. Check the LICENSE file for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBlinkUX%2Fsequelize-mock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBlinkUX%2Fsequelize-mock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBlinkUX%2Fsequelize-mock/lists"}