Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@knorm/postgres

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@knorm/postgres - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

4

lib/KnormPostgres.js

@@ -324,7 +324,7 @@ const { Knorm } = require('@knorm/knorm');

if (this.options.limit) {
if (this.options.limit !== undefined) {
sql.limit(this.options.limit);
}
if (this.options.offset) {
if (this.options.offset !== undefined) {
sql.offset(this.options.offset);

@@ -331,0 +331,0 @@ }

{
"name": "@knorm/postgres",
"version": "1.1.1",
"version": "1.1.2",
"description": "Postgres plugin for knorm",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -516,2 +516,38 @@ const knorm = require('@knorm/knorm');

it('supports `limit: 0`', async () => {
await new Query(User).insert([
{ id: 1, name: 'foo' },
{ id: 2, name: 'bar' }
]);
await expect(
new Query(User).limit(0).fetch(),
'to be fulfilled with value satisfying',
[]
);
});
it('supports `offset: 0`', async () => {
await new Query(User).insert([
{ id: 1, name: 'foo' },
{ id: 2, name: 'bar' }
]);
const spy = sinon.spy(Query.prototype, 'query');
await expect(
new Query(User).offset(0).fetch(),
'to be fulfilled with value satisfying',
[{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }]
);
await expect(spy, 'to have calls satisfying', () => {
spy(
expect.it(
'when passed as parameter to',
query => query.toString(),
'to contain',
'OFFSET 0'
)
);
});
spy.restore();
});
it('adds `limit` for `fetch` when `first` is true', async () => {

@@ -518,0 +554,0 @@ await new Query(User).insert({ id: 1, name: 'foo' });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc