increment.test.js 884 B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. const { expect } = require('chai');
  3. const { DataTypes } = require('@sequelize/core');
  4. const { beforeAll2, sequelize } = require('../support');
  5. describe('Model.increment', () => {
  6. const vars = beforeAll2(() => {
  7. const User = sequelize.define('User', {
  8. id: {
  9. type: DataTypes.INTEGER,
  10. primaryKey: true,
  11. autoIncrement: true,
  12. },
  13. count: DataTypes.INTEGER,
  14. });
  15. return { User };
  16. });
  17. it('should reject if options are missing', async () => {
  18. await expect(vars.User.increment(['id', 'count'])).to.be.rejectedWith(
  19. 'Missing where attribute in the options parameter',
  20. );
  21. });
  22. it('should reject if options.where are missing', async () => {
  23. await expect(vars.User.increment(['id', 'count'], { by: 10 })).to.be.rejectedWith(
  24. 'Missing where attribute in the options parameter',
  25. );
  26. });
  27. });