@@ -3049,7 +3049,7 @@ module(basename(__filename), function () {
3049
3049
} ) ;
3050
3050
} ) ;
3051
3051
3052
- module ( 'various other realm tests' , function ( hooks ) {
3052
+ module . only ( 'various other realm tests' , function ( hooks ) {
3053
3053
let testRealmHttpServer2 : Server ;
3054
3054
let testRealmServer2 : RealmServer ;
3055
3055
let testRealm2 : Realm ;
@@ -3301,6 +3301,100 @@ module(basename(__filename), function () {
3301
3301
}
3302
3302
} ) ;
3303
3303
3304
+ test ( 'POST /_create-realm without copying seed realm' , async function ( assert ) {
3305
+ // we randomize the realm and owner names so that we can isolate matrix
3306
+ // test state--there is no "delete user" matrix API
3307
+ let endpoint = `test-realm-${ uuidv4 ( ) } ` ;
3308
+ let owner = 'mango' ;
3309
+ let ownerUserId = '@mango:boxel.ai' ;
3310
+ let response = await request2
3311
+ . post ( '/_create-realm' )
3312
+ . set ( 'Accept' , 'application/vnd.api+json' )
3313
+ . set ( 'Content-Type' , 'application/json' )
3314
+ . set (
3315
+ 'Authorization' ,
3316
+ `Bearer ${ createRealmServerJWT (
3317
+ { user : ownerUserId , sessionRoom : 'session-room-test' } ,
3318
+ secretSeed ,
3319
+ ) } `,
3320
+ )
3321
+ . send (
3322
+ JSON . stringify ( {
3323
+ data : {
3324
+ type : 'realm' ,
3325
+ attributes : {
3326
+ ...testRealmInfo ,
3327
+ endpoint,
3328
+ backgroundURL : 'http://example.com/background.jpg' ,
3329
+ iconURL : 'http://example.com/icon.jpg' ,
3330
+ copyFromSeedRealm : false ,
3331
+ } ,
3332
+ } ,
3333
+ } ) ,
3334
+ ) ;
3335
+
3336
+ assert . strictEqual ( response . status , 201 , 'HTTP 201 status' ) ;
3337
+ let json = response . body ;
3338
+ assert . deepEqual (
3339
+ json ,
3340
+ {
3341
+ data : {
3342
+ type : 'realm' ,
3343
+ id : `${ testRealm2URL . origin } /${ owner } /${ endpoint } /` ,
3344
+ attributes : {
3345
+ ...testRealmInfo ,
3346
+ endpoint,
3347
+ backgroundURL : 'http://example.com/background.jpg' ,
3348
+ iconURL : 'http://example.com/icon.jpg' ,
3349
+ copyFromSeedRealm : false ,
3350
+ } ,
3351
+ } ,
3352
+ } ,
3353
+ 'realm creation JSON is correct' ,
3354
+ ) ;
3355
+
3356
+ let realmPath = join ( dir . name , 'realm_server_2' , owner , endpoint ) ;
3357
+ let realmJSON = readJSONSync ( join ( realmPath , '.realm.json' ) ) ;
3358
+ assert . deepEqual (
3359
+ realmJSON ,
3360
+ {
3361
+ name : 'Test Realm' ,
3362
+ backgroundURL : 'http://example.com/background.jpg' ,
3363
+ iconURL : 'http://example.com/icon.jpg' ,
3364
+ } ,
3365
+ '.realm.json is correct' ,
3366
+ ) ;
3367
+ assert . ok (
3368
+ existsSync ( join ( realmPath , 'index.json' ) ) ,
3369
+ 'seed file index.json exists' ,
3370
+ ) ;
3371
+ assert . notOk (
3372
+ existsSync (
3373
+ join (
3374
+ realmPath ,
3375
+ 'HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0.json' ,
3376
+ ) ,
3377
+ ) ,
3378
+ 'seed file HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0.json exists' ,
3379
+ ) ;
3380
+ assert . notOk (
3381
+ existsSync ( join ( realmPath , 'package.json' ) ) ,
3382
+ 'ignored seed file package.json does not exist' ,
3383
+ ) ;
3384
+ assert . notOk (
3385
+ existsSync ( join ( realmPath , 'node_modules' ) ) ,
3386
+ 'ignored seed file node_modules/ does not exist' ,
3387
+ ) ;
3388
+ assert . notOk (
3389
+ existsSync ( join ( realmPath , '.gitignore' ) ) ,
3390
+ 'ignored seed file .gitignore does not exist' ,
3391
+ ) ;
3392
+ assert . notOk (
3393
+ existsSync ( join ( realmPath , 'tsconfig.json' ) ) ,
3394
+ 'ignored seed file tsconfig.json does not exist' ,
3395
+ ) ;
3396
+ } ) ;
3397
+
3304
3398
test ( 'dynamically created realms are not publicly readable or writable' , async function ( assert ) {
3305
3399
let endpoint = `test-realm-${ uuidv4 ( ) } ` ;
3306
3400
let owner = 'mango' ;
0 commit comments