MCPcopy Index your code
hub / github.com/payloadcms/payload / noTimestampsTestLocalAPI

Function noTimestampsTestLocalAPI

test/database/int.spec.ts:670–713  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

668 })
669
670 async function noTimestampsTestLocalAPI() {
671 const createdDoc: any = await payload.create({
672 collection: 'noTimeStamps',
673 data: {
674 title: 'hello',
675 },
676 })
677 expect(createdDoc.createdAt).toBeUndefined()
678 expect(createdDoc.updatedAt).toBeUndefined()
679
680 const updated: any = await payload.update({
681 id: createdDoc.id,
682 collection: 'noTimeStamps',
683 data: {
684 title: 'updated',
685 },
686 })
687 expect(updated.createdAt).toBeUndefined()
688 expect(updated.updatedAt).toBeUndefined()
689
690 const date = new Date('2021-01-01T00:00:00.000Z').toISOString()
691 const createdDocWithTimestamps: any = await payload.create({
692 collection: 'noTimeStamps',
693 data: {
694 createdAt: date,
695 title: 'hello',
696 updatedAt: date,
697 },
698 })
699 expect(createdDocWithTimestamps.createdAt).toBeUndefined()
700 expect(createdDocWithTimestamps.updatedAt).toBeUndefined()
701
702 const updatedDocWithTimestamps: any = await payload.update({
703 id: createdDocWithTimestamps.id,
704 collection: 'noTimeStamps',
705 data: {
706 createdAt: date,
707 title: 'updated',
708 updatedAt: date,
709 },
710 })
711 expect(updatedDocWithTimestamps.createdAt).toBeUndefined()
712 expect(updatedDocWithTimestamps.updatedAt).toBeUndefined()
713 }
714
715 async function noTimestampsTestDB(aa) {
716 const createdDoc: any = await payload.db.create({

Callers 1

int.spec.tsFile · 0.85

Calls 2

createMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…