+ await checkNotification(base, notificationChecker, emailNotificationFinder, type)
+}
+
+async function checkAutoInstanceFollowing (base: CheckerBaseParams, followerHost: string, followingHost: string, type: CheckerType) {
+ const notificationType = UserNotificationType.AUTO_INSTANCE_FOLLOWING
+
+ function notificationChecker (notification: UserNotification, type: CheckerType) {
+ if (type === 'presence') {
+ expect(notification).to.not.be.undefined
+ expect(notification.type).to.equal(notificationType)
+
+ const following = notification.actorFollow.following
+ checkActor(following)
+ expect(following.name).to.equal('peertube')
+ expect(following.host).to.equal(followingHost)
+
+ expect(notification.actorFollow.follower.name).to.equal('peertube')
+ expect(notification.actorFollow.follower.host).to.equal(followerHost)
+ } else {
+ expect(notification).to.satisfy(n => {
+ return n.type !== notificationType || n.actorFollow.following.host !== followingHost
+ })
+ }
+ }
+
+ function emailNotificationFinder (email: object) {
+ const text: string = email['text']
+
+ return text.includes(' automatically followed a new instance') && text.includes(followingHost)
+ }
+
+ await checkNotification(base, notificationChecker, emailNotificationFinder, type)