import { values } from 'lodash'
import * as Sequelize from 'sequelize'
import {
- AfterCreate, AfterDestroy, AfterUpdate,
- AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, IsInt, Max, Model, Table,
- UpdatedAt
+ AfterCreate, AfterDestroy, AfterUpdate, AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, IsInt, Max, Model,
+ Table, UpdatedAt
} from 'sequelize-typescript'
import { FollowState } from '../../../shared/models/actors'
import { AccountFollow } from '../../../shared/models/actors/follow.model'
@AfterCreate
@AfterUpdate
static incrementFollowerAndFollowingCount (instance: ActorFollowModel) {
- if (instance.state !== 'accepted') return
+ if (instance.state !== 'accepted') return undefined
return Promise.all([
ActorModel.incrementFollows(instance.actorId, 'followingCount', 1),
expect(follows.length).to.equal(0)
})
- it('Should have the correct following counts', async function () {
+ it('Should have the correct follows counts', async function () {
await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 2)
await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0)
await expectAccountFollows(servers[0].url, 'peertube@localhost:9003', 1, 0)
expect(follows.length).to.equal(0)
})
- it('Should have the correct following counts 2', async function () {
+ it('Should have the correct follows counts 2', async function () {
await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 1)
await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0)
await wait(7000)
})
- it('Should have the correct following counts 2', async function () {
+ it('Should have the correct follows counts 3', async function () {
await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 2)
await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0)
await expectAccountFollows(servers[0].url, 'peertube@localhost:9003', 1, 0)