Repository: sequelize/sequelize
File: packages/core/test/integration/model/findAll.test.js (JavaScript)

Code before:
      const info = await this.User.findAndCountAll({
        where: { id: { [Op.ne]: this.users[0].id } },
        attributes: ['data'],
      });
      expect(info.count).to.equal(2);
      expect(Array.isArray(info.rows)).to.be.ok;
      expect(info.rows.length).to.equal(2);
      expect(info.rows[0].dataValues).to.not.have.property('username');
      expect(info.rows[1].dataValues).to.not.have.property('username');
    });

    it('handles grouped rows', async function () {
      const info = await this.User.findAndCountAll({
        attributes: [
          [Sequelize.fn('sum', Sequelize.col('intVal')), 'sum'],
          Sequelize.col('intVal'),
        ],
        group: [Sequelize.col('intVal')],
        countGroupedRows: true,
        raw: true,
      });
      expect(info.count).to.equal(1);
      expect(Array.isArray(info.rows)).to.be.ok;
      const row = info.rows[0];
      // MySQL returns sum as string, other dialects return number
      row.sum = Number(row.sum);
      expect(info.rows).to.deep.equal([row]);
    });
  });

  describe('all', () => {
    beforeEach(async function () {
      await this.User.bulkCreate([
        { username: 'user', data: 'foobar' },
        { username: 'user2', data: 'bar' },
      ]);
    });

    if (current.dialect.supports.transactions) {
      it('supports transactions', async function () {
        const sequelize = await Support.createSingleTransactionalTestSequelizeInstance(
          this.sequelize,
        );
        const User = sequelize.define('User', { username: DataTypes.STRING });

        await User.sync({ force: true });
        const t = await sequelize.startUnmanagedTransaction();
        await User.create({ username: 'foo' }, { transaction: t });
        const users1 = await User.findAll();
        const users2 = await User.findAll({ transaction: t });
        expect(users1.length).to.equal(0);

Review comment (suggestion):
```suggestion
      if (dialectName === 'mysql) {
         row.sum = Number(row.sum)
      }
```
This conveys the same information as the comment, with the added benefit of not changing `row.sum` for the other dialects

Code after:
      const info = await this.User.findAndCountAll({
        where: { id: { [Op.ne]: this.users[0].id } },
        attributes: ['data'],
      });
      expect(info.count).to.equal(2);
      expect(Array.isArray(info.rows)).to.be.ok;
      expect(info.rows.length).to.equal(2);
      expect(info.rows[0].dataValues).to.not.have.property('username');
      expect(info.rows[1].dataValues).to.not.have.property('username');
    });

    it('handles grouped rows', async function () {
      const info = await this.User.findAndCountAll({
        attributes: [
          [Sequelize.fn('sum', Sequelize.col('intVal')), 'sum'],
          Sequelize.col('intVal'),
        ],
        group: [Sequelize.col('intVal')],
        countGroupedRows: true,
        raw: true,
      });
      expect(info.count).to.equal(1);
      expect(Array.isArray(info.rows)).to.be.ok;
      const row = info.rows[0];
      if (dialectName === 'mysql') {
        row.sum = Number(row.sum);
      }

      expect(info.rows).to.deep.equal([row]);
    });
  });

  describe('all', () => {
    beforeEach(async function () {
      await this.User.bulkCreate([
        { username: 'user', data: 'foobar' },
        { username: 'user2', data: 'bar' },
      ]);
    });

    if (current.dialect.supports.transactions) {
      it('supports transactions', async function () {
        const sequelize = await Support.createSingleTransactionalTestSequelizeInstance(
          this.sequelize,
        );
        const User = sequelize.define('User', { username: DataTypes.STRING });

        await User.sync({ force: true });
        const t = await sequelize.startUnmanagedTransaction();
        await User.create({ username: 'foo' }, { transaction: t });
        const users1 = await User.findAll();