test: fix some easy eslint errors
This commit is contained in:
@@ -49,13 +49,13 @@ describe('Auth', () => {
|
|||||||
token = data.loginUser.token
|
token = data.loginUser.token
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should login', async () => {
|
it('should login', () => {
|
||||||
expect(user.id).toBeDefined()
|
expect(user.id).toBeDefined()
|
||||||
expect(user.email).toEqual(devUser.email)
|
expect(user.email).toEqual(devUser.email)
|
||||||
expect(token).toBeDefined()
|
expect(token).toBeDefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should have fields saved to JWT', async () => {
|
it('should have fields saved to JWT', () => {
|
||||||
const decoded = jwtDecode<User>(token)
|
const decoded = jwtDecode<User>(token)
|
||||||
const { collection, email: jwtEmail, exp, iat, roles } = decoded
|
const { collection, email: jwtEmail, exp, iat, roles } = decoded
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ describe('Auth', () => {
|
|||||||
expect(data.user.email).toBeDefined()
|
expect(data.user.email).toBeDefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should have fields saved to JWT', async () => {
|
it('should have fields saved to JWT', () => {
|
||||||
const decoded = jwtDecode<User>(token)
|
const decoded = jwtDecode<User>(token)
|
||||||
const {
|
const {
|
||||||
collection,
|
collection,
|
||||||
@@ -331,7 +331,7 @@ describe('Auth', () => {
|
|||||||
data = await response.json()
|
data = await response.json()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should create', async () => {
|
it('should create', () => {
|
||||||
expect(data.doc.key).toStrictEqual(key)
|
expect(data.doc.key).toStrictEqual(key)
|
||||||
expect(data.doc.value.property).toStrictEqual(property)
|
expect(data.doc.value.property).toStrictEqual(property)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import type { Post } from './payload-types.js'
|
|||||||
import { getPayload } from '../../packages/payload/src/index.js'
|
import { getPayload } from '../../packages/payload/src/index.js'
|
||||||
import { mapAsync } from '../../packages/payload/src/utilities/mapAsync.js'
|
import { mapAsync } from '../../packages/payload/src/utilities/mapAsync.js'
|
||||||
import { NextRESTClient } from '../helpers/NextRESTClient.js'
|
import { NextRESTClient } from '../helpers/NextRESTClient.js'
|
||||||
import { initPayloadInt } from '../helpers/initPayloadInt.js'
|
|
||||||
import { idToString } from '../helpers/idToString.js'
|
import { idToString } from '../helpers/idToString.js'
|
||||||
|
import { initPayloadInt } from '../helpers/initPayloadInt.js'
|
||||||
import { startMemoryDB } from '../startMemoryDB.js'
|
import { startMemoryDB } from '../startMemoryDB.js'
|
||||||
import configPromise, { errorOnHookSlug, pointSlug, relationSlug, slug } from './config.js'
|
import configPromise, { errorOnHookSlug, pointSlug, relationSlug, slug } from './config.js'
|
||||||
|
|
||||||
@@ -619,7 +619,7 @@ describe('collections-graphql', () => {
|
|||||||
|
|
||||||
it('should sort find results by nearest distance', async () => {
|
it('should sort find results by nearest distance', async () => {
|
||||||
// creating twice as many records as we are querying to get a random sample
|
// creating twice as many records as we are querying to get a random sample
|
||||||
await mapAsync([...Array(10)], async () => {
|
await mapAsync([...Array(10)], () => {
|
||||||
// setTimeout used to randomize the creation timestamp
|
// setTimeout used to randomize the creation timestamp
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await payload.create({
|
await payload.create({
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ describe('Fields', () => {
|
|||||||
data: { text },
|
data: { text },
|
||||||
})
|
})
|
||||||
|
|
||||||
await expect(fieldWithDefaultValue).toEqual(dependentOnFieldWithDefaultValue)
|
expect(fieldWithDefaultValue).toEqual(dependentOnFieldWithDefaultValue)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should localize an array of strings using hasMany', async () => {
|
it('should localize an array of strings using hasMany', async () => {
|
||||||
@@ -326,7 +326,7 @@ describe('Fields', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('creates with default values', async () => {
|
it('creates with default values', () => {
|
||||||
expect(doc.number).toEqual(numberDoc.number)
|
expect(doc.number).toEqual(numberDoc.number)
|
||||||
expect(doc.min).toEqual(numberDoc.min)
|
expect(doc.min).toEqual(numberDoc.min)
|
||||||
expect(doc.max).toEqual(numberDoc.max)
|
expect(doc.max).toEqual(numberDoc.max)
|
||||||
@@ -642,7 +642,7 @@ describe('Fields', () => {
|
|||||||
expect(docWithIDs.group.subGroup.arrayWithinGroup[0].id).toBeDefined()
|
expect(docWithIDs.group.subGroup.arrayWithinGroup[0].id).toBeDefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should create with defaultValue', async () => {
|
it('should create with defaultValue', () => {
|
||||||
expect(doc.items).toMatchObject(arrayDefaultValue)
|
expect(doc.items).toMatchObject(arrayDefaultValue)
|
||||||
expect(doc.localized).toMatchObject(arrayDefaultValue)
|
expect(doc.localized).toMatchObject(arrayDefaultValue)
|
||||||
})
|
})
|
||||||
@@ -783,12 +783,12 @@ describe('Fields', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should create with defaultValue', async () => {
|
it('should create with defaultValue', () => {
|
||||||
expect(document.group.defaultParent).toStrictEqual(groupDefaultValue)
|
expect(document.group.defaultParent).toStrictEqual(groupDefaultValue)
|
||||||
expect(document.group.defaultChild).toStrictEqual(groupDefaultChild)
|
expect(document.group.defaultChild).toStrictEqual(groupDefaultChild)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should not have duplicate keys', async () => {
|
it('should not have duplicate keys', () => {
|
||||||
expect(document.arrayOfGroups[0]).toMatchObject({
|
expect(document.arrayOfGroups[0]).toMatchObject({
|
||||||
id: expect.any(String),
|
id: expect.any(String),
|
||||||
groupItem: {
|
groupItem: {
|
||||||
@@ -808,15 +808,15 @@ describe('Fields', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should create with fields inside a named tab', async () => {
|
it('should create with fields inside a named tab', () => {
|
||||||
expect(document.tab.text).toStrictEqual(namedTabText)
|
expect(document.tab.text).toStrictEqual(namedTabText)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should create with defaultValue inside a named tab', async () => {
|
it('should create with defaultValue inside a named tab', () => {
|
||||||
expect(document.tab.defaultValue).toStrictEqual(namedTabDefaultValue)
|
expect(document.tab.defaultValue).toStrictEqual(namedTabDefaultValue)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should create with defaultValue inside a named tab with no other values', async () => {
|
it('should create with defaultValue inside a named tab with no other values', () => {
|
||||||
expect(document.namedTabWithDefaultValue.defaultValue).toStrictEqual(namedTabDefaultValue)
|
expect(document.namedTabWithDefaultValue.defaultValue).toStrictEqual(namedTabDefaultValue)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ describe('Hooks', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should execute hooks in correct order on create', async () => {
|
it('should execute hooks in correct order on create', () => {
|
||||||
expect(doc.collectionAfterChange).toBeTruthy()
|
expect(doc.collectionAfterChange).toBeTruthy()
|
||||||
expect(doc.collectionAfterRead).toBeTruthy()
|
expect(doc.collectionAfterRead).toBeTruthy()
|
||||||
expect(doc.collectionBeforeChange).toBeTruthy()
|
expect(doc.collectionBeforeChange).toBeTruthy()
|
||||||
|
|||||||
Reference in New Issue
Block a user