File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
packages/next/src/views/Document Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,10 @@ export const Document: React.FC<AdminViewProps> = async ({
75
75
req,
76
76
} )
77
77
78
+ if ( ! data ) {
79
+ notFound ( )
80
+ }
81
+
78
82
const { docPermissions, hasPublishPermission, hasSavePermission } = await getDocumentPermissions ( {
79
83
id,
80
84
collectionConfig,
Original file line number Diff line number Diff line change @@ -336,6 +336,20 @@ describe('admin1', () => {
336
336
} )
337
337
338
338
describe ( 'routing' , ( ) => {
339
+ test ( 'should 404 not found root pages' , async ( ) => {
340
+ await page . goto ( `${ serverURL } /admin/1234` )
341
+ const response = await page . waitForResponse ( ( response ) => response . status ( ) === 404 )
342
+ expect ( response ) . toBeTruthy ( )
343
+ await expect ( page . locator ( '.not-found' ) ) . toContainText ( 'Nothing found' )
344
+ } )
345
+
346
+ test ( 'should 404 not found documents' , async ( ) => {
347
+ await page . goto ( `${ postsUrl . collection ( postsCollectionSlug ) } /1234` )
348
+ const response = await page . waitForResponse ( ( response ) => response . status ( ) === 404 )
349
+ expect ( response ) . toBeTruthy ( )
350
+ await expect ( page . locator ( '.not-found' ) ) . toContainText ( 'Nothing found' )
351
+ } )
352
+
339
353
test ( 'should use custom logout route' , async ( ) => {
340
354
await page . goto ( `${ serverURL } ${ adminRoutes . routes . admin } ${ adminRoutes . admin . routes . logout } ` )
341
355
Original file line number Diff line number Diff line change 37
37
],
38
38
"paths" : {
39
39
"@payload-config" : [
40
- " ./test/_community /config.ts"
40
+ " ./test/admin /config.ts"
41
41
],
42
42
"@payloadcms/live-preview" : [
43
43
" ./packages/live-preview/src"
You can’t perform that action at this time.
0 commit comments