1
0
Fork 0
This commit is contained in:
Chocobozzz 2018-01-12 12:18:11 +01:00
parent a3fd560d11
commit 38768a367b
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 6 additions and 8 deletions

View File

@ -1,5 +1,4 @@
import * as Sequelize from 'sequelize'
import { ACTOR_FOLLOW_SCORE } from '../index'
async function up (utils: {
transaction: Sequelize.Transaction,

View File

@ -2,9 +2,8 @@ import * as Bluebird from 'bluebird'
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'
@ -83,7 +82,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
@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),

View File

@ -117,7 +117,7 @@ describe('Test follows', function () {
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)
@ -158,7 +158,7 @@ describe('Test follows', function () {
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)
@ -248,7 +248,7 @@ describe('Test follows', function () {
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)