@@ -6,12 +6,6 @@ import startPlebbitRpc from './start-plebbit-rpc.js'
66import signers from '../fixtures/signers.js'
77import { directory as getTmpFolderPath } from 'tempy'
88import http from 'http'
9- import fs from 'fs'
10- import path from 'path'
11- import { fileURLToPath } from 'url'
12-
13- const __filename = fileURLToPath ( import . meta. url )
14- const __dirname = path . dirname ( __filename )
159const plebbitDataPath = getTmpFolderPath ( )
1610
1711// set up a subplebbit for testing
@@ -47,32 +41,6 @@ const plebbitDataPath = getTmpFolderPath()
4741 } )
4842 const signer = await plebbit . createSigner ( { privateKey, type : 'ed25519' } )
4943
50- // Create a signer for testing ENS domain address editing
51- // The 'my-sub.eth' domain should resolve to this signer's address
52- const ensTestSigner = await plebbit . createSigner ( )
53- const ensTestDomain = 'my-sub.eth'
54-
55- // Mock the ENS text record for 'my-sub.eth' to point to ensTestSigner.address
56- // This allows the test to successfully edit a subplebbit's address to 'my-sub.eth'
57- const cacheKey = plebbit . _clientsManager . _getKeyOfCachedDomainTextRecord ( ensTestDomain , 'subplebbit-address' )
58- const timestamp = ( ) => Math . floor ( Date . now ( ) / 1000 )
59- await plebbit . _storage . setItem ( cacheKey , {
60- timestampSeconds : timestamp ( ) ,
61- valueOfTextRecord : ensTestSigner . address ,
62- } )
63- console . log ( `Mocked ENS text record '${ ensTestDomain } ' -> '${ ensTestSigner . address } '` )
64-
65- // Export the ENS test signer info to a file so tests can use it
66- const ensTestSignerInfo = {
67- privateKey : ensTestSigner . privateKey ,
68- address : ensTestSigner . address ,
69- type : ensTestSigner . type ,
70- domain : ensTestDomain ,
71- }
72- const signerInfoPath = path . join ( __dirname , 'ens-test-signer.json' )
73- fs . writeFileSync ( signerInfoPath , JSON . stringify ( ensTestSignerInfo , null , 2 ) )
74- console . log ( `Exported ENS test signer info to '${ signerInfoPath } '` )
75-
7644 console . log ( `creating subplebbit with address '${ signer . address } '...` )
7745 const subplebbit = await plebbit . createSubplebbit ( {
7846 signer : signer ,
@@ -114,13 +82,7 @@ const plebbitDataPath = getTmpFolderPath()
11482 http
11583 . createServer ( ( req , res ) => {
11684 res . setHeader ( 'Access-Control-Allow-Origin' , '*' )
117- if ( req . url === '/ens-test-signer' ) {
118- // Return the ENS test signer info for browser tests
119- res . setHeader ( 'Content-Type' , 'application/json' )
120- res . end ( JSON . stringify ( ensTestSignerInfo ) )
121- } else {
122- res . end ( 'test server ready' )
123- }
85+ res . end ( 'test server ready' )
12486 } )
12587 . listen ( 59281 )
12688 } )
0 commit comments