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: job_test.go
    path of file: ./repos/chainlink/core/web/resolver
    
    the code of the file until where you have to start completion: package resolver

import (
	"database/sql"
	"encoding/json"
	"fmt"
	"testing"
	"time"

	"github.com/google/uuid"
	gqlerrors "github.com/graph-gophers/graphql-go/errors"
	"github.com/pkg/errors"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/mock"
	"gopkg.in/guregu/null.v4"

	"github.com/smartcontractkit/chainlink/v2/core/chains"
	clnull "github.com/smartcontractkit/chainlink/v2/core/null"
	"github.com/smartcontractkit/chainlink/v2/core/services/directrequest"
	"github.com/smartcontractkit/chainlink/v2/core/services/job"
	"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
	"github.com/smartcontractkit/chainlink/v2/core/store/models"
	"github.com/smartcontractkit/chainlink/v2/core/testdata/testspecs"
	"github.com/smartcontractkit/chainlink/v2/core/utils/stringutils"
)

// This tests the main fields on the job results. Embedded spec testing is done
// in the `spec_test` file
func TestResolver_Jobs(t *testing.T) {
	var (
		externalJobID = uuid.MustParse(("00000000-0000-0000-0000-000000000001"))

		query = `
			query GetJobs {
				jobs {
					results {
						id
						createdAt
						externalJobID
						gasLimit
						forwardingAllowed
						maxTaskDuration
						name
						schemaVersion
						spec {
							__typename
						}
						runs {
							__typename
							results {
								id
							}
							metadata {
								total
							}
						}
						observationSource
					}
					metadata {
						total
					}
				}
			}`
	)

	testCases := []GQLTestCase{
		unauthorizedTestCase(GQLTestCase{query: query}, "jobs"),
		{
			name:          "get jobs success",
			authenticated: true,
			before: func(f *gqlTestFramework) {
				plnSpecID := int32(12)

				f.App.On("JobORM").Return(f.Mocks.jobORM)
				f.Mocks.jobORM.On("FindJobs", 0, 50).Return([]job.Job{
					{
						ID:              1,
						Name:            null.StringFrom("job1"),
						SchemaVersion:   1,
						MaxTaskDuration: models.Interval(1 * time.Second
    
func TestResolver_CreateJob(t *testing.T) {
	t.Parallel()

	mutation := `
		mutation CreateJob($input: CreateJobInput!) {
			createJob(input: $input) {
				... on CreateJobSuccess {
					job {
						id
						createdAt
						externalJobID
						maxTaskDuration
						name
						schemaVersion
					}
				}
				... on InputErrors {
					errors {
						path
						message
						code
					}
				}
			}
		}`
	uuid := uuid.New()
	spec := fmt.Sprintf(testspecs.DirectRequestSpecTemplate, uuid, uuid)
	variables := map[string]interface{}{
		"input": map[string]interface{}{
			"TOML": spec,
		},
	}
	invalid := map[string]interface{}{
		"input": map[string]interface{}{
			"TOML": "some wrong value",
		},
	}
	jb, err := directrequest.ValidatedDirectRequestSpec(spec)
	assert.NoError(t, err)

	d, err := json.Marshal(map[string]interface{}{
		"createJob": map[string]interface{}{
			"job": map[string]interface{}{
				"id":              "0",
				"maxTaskDuration": "0s",
				"name":            jb.Name,
				"schemaVersion":   1,
				"createdAt":       "0001-01-01T00:00:00Z",
				"externalJobID":   jb.ExternalJobID.String(),
			},
		},
	})
	assert.NoError(t, err)
	expected := string(d)

	gError := errors.New("error")

	testCases := []GQLTestCase{
		unauthorizedTestCase(GQLTestCase{query: mutation, variables: variables}, "createJob"),
		{
			name:          "success",
			authenticated: true,
			before: func(f *gqlTestFramework) {
				f.App.On("GetConfig").Return(f.Mocks.cfg)
				f.App.On("AddJobV2", mock.Anything, &jb).Return(nil)
			},
			query:     mutation,
			variables: variables,
			result:    expected,
		},
		{
			name:          "invalid TOML error",
			authenticated: true,
			query:         mutation,
			variables:     invalid,
			result: `
				{
					"createJob": {
						"errors": [{
							"code": "INVALID_INPUT",
							"message": "failed to parse TOML: (1, 6): was expecting token =, but got \"wrong\" instead",
							"path": "TOML spec"
						}]
					}
				}`,
		},
		{
			name:          "generic error when adding the job",
			authenticated: true,
			before: func(f *gqlTestFramework) {
				f.App.On("GetConfig").Return(f.Mocks.cfg)
				f.App.On("AddJobV2", mock.Anything, &jb).Return(gError)
			},
			query:     mutation,
			variables: variables,
			result:    `null`,
			errors: []*gqlerrors.QueryError{
				{
					Extensions:    nil,
					ResolverError: gError,
					Path:          []interface{}{"createJob"},
					Message:       gError.Error(),
				},
			},
		},
	}

	RunGQLTests(t, testCases)
}