You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: email_batching_test.go
    path of file: ./repos/mattermost/server/channels/app/email
    
    the code of the file until where you have to start completion: // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

package email

import (
	"context"
	"sync/atomic"
	"testing"
	"time"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"

	"github.com/mattermost/mattermost/server/public/model"
)

func TestHandleNewNotifications(t *testing.T) {
	th := SetupWithStoreMock(t)
	defer th.TearDown()

	id1 := model.NewId()
	id2 := model.NewId()
	id3 := model.NewId()

	// test queueing of received posts by user
	job := NewEmailBatchingJob(th.service, 128)

	job.handleNewNotifications()

	require.Empty(t, job.pendingNotifications, "shouldn't have added any pending notifications")

	job.Add(&model.User{Id: id1}, &model.Post{UserId: id1, Message: "test"}, &model.Team{Name: "team"})
	require.Empty(t, job.pendingNotificati
    
func TestCheckPendingNotificationsDefaultInterval(t *testing.T) {
	th := Setup(t).InitBasic()
	defer th.TearDown()

	job := NewEmailBatchingJob(th.service, 128)

	// bypasses recent user activity check
	require.NotNil(t, th.store)
	require.NotNil(t, th.store.Channel())

	require.NotNil(t, th.BasicUser)
	require.NotNil(t, th.BasicChannel)
	channelMember, err := th.store.Channel().GetMember(context.Background(), th.BasicChannel.Id, th.BasicUser.Id)
	require.NoError(t, err)
	channelMember.LastViewedAt = 9999000
	_, err = th.store.Channel().UpdateMember(th.Context, channelMember)
	require.NoError(t, err)

	job.pendingNotifications[th.BasicUser.Id] = []*batchedNotification{
		{
			post: &model.Post{
				UserId:    th.BasicUser.Id,
				ChannelId: th.BasicChannel.Id,
				CreateAt:  10000000,
			},
			teamName: th.BasicTeam.Name,
		},
	}

	// notifications should not be sent 1s after post was created, because default batch interval is 15mins
	job.checkPendingNotifications(time.Unix(10001, 0), func(string, []*batchedNotification) {})
	require.NotNil(t, job.pendingNotifications[th.BasicUser.Id])
	require.Len(t, job.pendingNotifications[th.BasicUser.Id], 1, "shouldn't have sent queued post")

	// notifications should be sent 901s after post was created, because default batch interval is 15mins
	job.checkPendingNotifications(time.Unix(10901, 0), func(string, []*batchedNotification) {})
	require.Nil(t, job.pendingNotifications[th.BasicUser.Id])
	require.Empty(t, job.pendingNotifications[th.BasicUser.Id], "should have sent queued post")
}