Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions test/collections-graphql/int.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ describe('collections-graphql', () => {
const [lat, lng] = point

it('should return a document near a point', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
const nearQuery = `
Expand Down Expand Up @@ -644,7 +644,7 @@ describe('collections-graphql', () => {
})

it('should not return a point far away', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
const nearQuery = `
Expand Down Expand Up @@ -672,7 +672,7 @@ describe('collections-graphql', () => {
})

it('should sort find results by nearest distance', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
// creating twice as many records as we are querying to get a random sample
Expand Down Expand Up @@ -731,7 +731,7 @@ describe('collections-graphql', () => {
]

it('should return a document with the point inside the polygon', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
const query = `
Expand Down Expand Up @@ -762,7 +762,7 @@ describe('collections-graphql', () => {
})

it('should not return a document with the point outside the polygon', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
const reducedPolygon = polygon.map((vertex) => vertex.map((coord) => coord * 0.1))
Expand Down Expand Up @@ -804,7 +804,7 @@ describe('collections-graphql', () => {
]

it('should return a document with the point intersecting the polygon', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
const query = `
Expand Down Expand Up @@ -835,7 +835,7 @@ describe('collections-graphql', () => {
})

it('should not return a document with the point not intersecting a smaller polygon', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
const reducedPolygon = polygon.map((vertex) => vertex.map((coord) => coord * 0.1))
Expand Down
20 changes: 10 additions & 10 deletions test/collections-rest/int.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ describe('collections-rest', () => {
const point = [10, 20]
const [lat, lng] = point
it('should return a document near a point', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}

Expand Down Expand Up @@ -1184,7 +1184,7 @@ describe('collections-rest', () => {
})

it('should omit maxDistance and return a document from minDistance', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}

Expand All @@ -1205,7 +1205,7 @@ describe('collections-rest', () => {
})

it('should omit maxDistance and not return a document because exceeds minDistance', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}

Expand All @@ -1227,7 +1227,7 @@ describe('collections-rest', () => {

// https://github.com/payloadcms/payload/issues/14471 - ensure geospatial queries use true geodetic meters, not the distorted meters of EPSG:3857
it('should use true geodetic meters at high latitudes', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}

Expand Down Expand Up @@ -1269,7 +1269,7 @@ describe('collections-rest', () => {
})

it('should not return a point far away', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}

Expand All @@ -1290,7 +1290,7 @@ describe('collections-rest', () => {
})

it('should sort find results by nearest distance', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}

Expand Down Expand Up @@ -1345,7 +1345,7 @@ describe('collections-rest', () => {
[9.0, 19.0], // back to starting point to close the polygon
]
it('should return a document with the point inside the polygon', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
// There should be 1 total points document populated by default with the point [10, 20]
Expand All @@ -1368,7 +1368,7 @@ describe('collections-rest', () => {
})

it('should not return a document with the point outside a smaller polygon', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
const response = await restClient.GET(`/${pointSlug}`, {
Expand Down Expand Up @@ -1401,7 +1401,7 @@ describe('collections-rest', () => {
]

it('should return a document with the point intersecting the polygon', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
// There should be 1 total points document populated by default with the point [10, 20]
Expand All @@ -1424,7 +1424,7 @@ describe('collections-rest', () => {
})

it('should not return a document with the point not intersecting a smaller polygon', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
const response = await restClient.GET(`/${pointSlug}`, {
Expand Down
4 changes: 3 additions & 1 deletion test/custom-graphql/int.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ describe('Custom GraphQL', () => {
})

if (
!['cosmosdb', 'firestore', 'sqlite', 'sqlite-uuid'].includes(process.env.PAYLOAD_DATABASE || '')
!['content-api', 'cosmosdb', 'firestore', 'sqlite', 'sqlite-uuid'].includes(
process.env.PAYLOAD_DATABASE || '',
)
) {
describe('Isolated Transaction ID', () => {
it('should isolate transaction IDs between queries in the same request', async () => {
Expand Down
26 changes: 22 additions & 4 deletions test/database/int.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,9 @@ describe('database', () => {
})

it('should run migrate', async () => {
if (payload.db.name === 'content-api') {
return
}
await payload.db.migrate()
const { docs } = await payload.find({
collection: 'payload-migrations',
Expand All @@ -1698,6 +1701,9 @@ describe('database', () => {
})

it('should run migrate:status', async () => {
if (payload.db.name === 'content-api') {
return
}
let error
try {
await payload.db.migrateStatus()
Expand All @@ -1708,6 +1714,9 @@ describe('database', () => {
})

it('should run migrate:fresh', async () => {
if (payload.db.name === 'content-api') {
return
}
await payload.db.migrateFresh({ forceAcceptWarning: true })
const { docs } = await payload.find({
collection: 'payload-migrations',
Expand Down Expand Up @@ -1894,6 +1903,9 @@ describe('database', () => {

describe('schema', () => {
it('should use custom dbNames', () => {
if (payload.db.name === 'content-api') {
return
}
expect(payload.db).toBeDefined()

if (payload.db.name === 'mongoose') {
Expand Down Expand Up @@ -2021,7 +2033,9 @@ describe('database', () => {
describe('local api', () => {
// sqlite cannot handle concurrent write transactions
if (
!['cosmosdb', 'firestore', 'sqlite', 'sqlite-uuid'].includes(process.env.PAYLOAD_DATABASE)
!['content-api', 'cosmosdb', 'firestore', 'sqlite', 'sqlite-uuid'].includes(
process.env.PAYLOAD_DATABASE,
)
) {
it('should commit multiple operations in isolation', async () => {
const req = {
Expand Down Expand Up @@ -3120,7 +3134,7 @@ describe('database', () => {
})

it('should extend the existing table with extra column and modify the existing column with enforcing DB level length', async () => {
if (payload.db.name === 'mongoose') {
if (payload.db.name === 'mongoose' || payload.db.name === 'content-api') {
return
}

Expand Down Expand Up @@ -3185,7 +3199,7 @@ describe('database', () => {
})

it('should extend the existing table with composite unique and throw ValidationError on it', async () => {
if (payload.db.name === 'mongoose') {
if (payload.db.name === 'mongoose' || payload.db.name === 'content-api') {
return
}

Expand Down Expand Up @@ -3855,10 +3869,14 @@ describe('database', () => {
})

it('should not allow document creation with relationship data to an invalid document ID', async () => {
if (payload.db.name === 'content-api') {
return
}

let invalidDoc

// mongo requires ObjectId, postgres UUID and content-api number (wrong type for text ID)
const invalidId = payload.db.name === 'content_api' ? 1 : 'not-real-id'
const invalidId = payload.db.name === 'content-api' ? 1 : 'not-real-id'

try {
invalidDoc = await payload.create({
Expand Down
24 changes: 18 additions & 6 deletions test/fields/int.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,9 @@ describe('Fields', () => {
})

it('should query relationship inside array', async () => {
if (payload.db.name === 'content-api') {
return
}
const result = await payload.find({
collection: relationshipFieldsSlug,
where: {
Expand Down Expand Up @@ -1514,10 +1517,16 @@ describe('Fields', () => {
})

it('should have 2dsphere indexes on point fields', () => {
if (payload.db.name === 'content-api') {
return
}
expect(definitions.point).toEqual('2dsphere')
})

it('should have 2dsphere indexes on point fields in groups', () => {
if (payload.db.name === 'content-api') {
return
}
expect(definitions['group.point']).toEqual('2dsphere')
})

Expand Down Expand Up @@ -1578,7 +1587,7 @@ describe('Fields', () => {
})

it('should read', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
const find = await payload.find({
Expand All @@ -1594,7 +1603,7 @@ describe('Fields', () => {
})

it('should create', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
doc = await payload.create({
Expand All @@ -1612,7 +1621,7 @@ describe('Fields', () => {
})

it('should not create duplicate point when unique', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
// Use unique values for this test to avoid collisions with other tests
Expand Down Expand Up @@ -1657,7 +1666,7 @@ describe('Fields', () => {
})

it('should throw validation error when "required" field is set to null', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
// Use unique values to avoid collisions
Expand Down Expand Up @@ -1686,7 +1695,7 @@ describe('Fields', () => {
})

it('should not throw validation error when non-"required" field is set to null', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}
// Use unique values to avoid collisions
Expand Down Expand Up @@ -1717,7 +1726,7 @@ describe('Fields', () => {
})

it('should not error with camel case name point field', async () => {
if (payload.db.name === 'sqlite') {
if (payload.db.name === 'sqlite' || payload.db.name === 'content-api') {
return
}

Expand Down Expand Up @@ -2986,6 +2995,9 @@ describe('Fields', () => {
})

it('should hot module reload and still be able to create', async () => {
if (payload.db.name === 'content-api') {
return
}
const testDoc1 = await payload.findByID({
id: document.id,
collection: tabsFieldsSlug,
Expand Down
Loading
Loading