https://github.com/bahmutov/objection-example
Simple Object.js ORM example copied from Vincit/objection.js
https://github.com/bahmutov/objection-example
cypress-example
Last synced: 9 months ago
JSON representation
Simple Object.js ORM example copied from Vincit/objection.js
- Host: GitHub
- URL: https://github.com/bahmutov/objection-example
- Owner: bahmutov
- Created: 2019-07-19T21:12:37.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-01-06T06:54:26.000Z (over 2 years ago)
- Last Synced: 2024-12-27T20:56:45.899Z (over 1 year ago)
- Topics: cypress-example
- Language: JavaScript
- Size: 349 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# objection-example [![renovate-app badge][renovate-badge]][renovate-app] [](https://circleci.com/gh/bahmutov/objection-example/tree/master)
> Simple Object.js ORM example copied from Vincit/objection.js
This example was copied from folder [examples/express-es7](https://github.com/Vincit/objection.js/tree/master/examples/express-es7) of [github.com/Vincit/objection.js](https://github.com/Vincit/objection.js). See [Objection.js docs](https://vincit.github.io/objection.js/)
The original client code that makes HTTP requests is in [client.js](client.js) but for this demo we are going to use [Cypress Test Runner](https://github.com/cypress-io/cypress) with [@bahmutov/cy-api](https://github.com/bahmutov/cy-api) plugin.

## Install
```shell
npm ci
```
## Run
To start local server and open Cypress
```shell
npm run dev
```
## Tests
There are several specs in [cypress/integration](cypress/integration) folder
- [movies-spec.js](cypress/integration/movies-spec.js) shows how to add a new movie, and how the API checks for required fields to be present
- [spec.js](cypress/integration/spec.js) shows complex calls to insert multiple entities in a single call, updating multiple objects using "upsert"
## More info
- Read ["Black box API testing with server logs"](https://glebbahmutov.com/blog/api-testing-with-sever-logs/) post.
- see another example [server-logs-example](https://github.com/bahmutov/server-logs-example)
[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg
[renovate-app]: https://renovateapp.com/
### Small print
Author: Gleb Bahmutov <gleb.bahmutov@gmail.com> © 2019
- [@bahmutov](https://twitter.com/bahmutov)
- [glebbahmutov.com](https://glebbahmutov.com)
- [blog](https://glebbahmutov.com/blog)
Original License: See [github.com/Vincit/objection.js](https://github.com/Vincit/objection.js)
Additions showing logs and Cypress tests under MIT License - do anything with the code, but don't blame me if it does not work.
Support: if you find any problems with this module, email / tweet /
[open issue](https://github.com/bahmutov/objection-example/issues) on Github