@@ -5,13 +5,14 @@ import {
55 applyInstanceChanges ,
66 assignShallow ,
77 computeInstanceEditChanges ,
8- createInstanceFromOptions ,
98} from './edit'
109import { VersionMetadataProvider } from './internal_type'
1110import { loadInstanceFromOptions } from './load'
11+ import { createInstance } from './index.browser'
1212
1313describe ( 'Instance Assignment Utils' , ( ) => {
1414 let mockVersionProvider : VersionMetadataProvider
15+ const getCandidatePath = ( name : string ) => `/instances/${ name } `
1516
1617 beforeEach ( ( ) => {
1718 mockVersionProvider = {
@@ -101,7 +102,7 @@ describe('Instance Assignment Utils', () => {
101102 expect ( instance . runtime . minecraft ) . toBe ( '1.19.2' )
102103 expect ( instance . runtime . forge ) . toBe ( '43.2.0' )
103104 expect ( instance . runtime . fabricLoader ) . toBe ( '0.14.21' )
104- expect ( instance . runtime . quiltLoader ) . toBeUndefined ( )
105+ expect ( instance . runtime . quiltLoader ) . toBeFalsy ( )
105106 } )
106107
107108 it ( 'should handle resolution settings' , ( ) => {
@@ -129,7 +130,7 @@ describe('Instance Assignment Utils', () => {
129130 } )
130131 } )
131132
132- describe ( 'createInstanceFromOptions ' , ( ) => {
133+ describe ( 'createInstance ' , ( ) => {
133134 it ( 'should create instance from creation options' , ( ) => {
134135 const payload : CreateInstanceOptions = {
135136 name : 'New Instance' ,
@@ -139,7 +140,7 @@ describe('Instance Assignment Utils', () => {
139140 icon : 'icon.png' ,
140141 }
141142
142- const instance = createInstanceFromOptions ( payload , mockVersionProvider )
143+ const instance = createInstance ( payload , getCandidatePath , mockVersionProvider )
143144
144145 expect ( instance . name ) . toBe ( 'New Instance' )
145146 expect ( instance . author ) . toBe ( 'Creator' )
@@ -156,7 +157,7 @@ describe('Instance Assignment Utils', () => {
156157 name : 'New Instance' ,
157158 }
158159
159- const instance = createInstanceFromOptions ( payload , mockVersionProvider )
160+ const instance = createInstance ( payload , getCandidatePath , mockVersionProvider )
160161
161162 expect ( instance . runtime . minecraft ) . toBe ( '1.19.2' )
162163 } )
@@ -167,7 +168,7 @@ describe('Instance Assignment Utils', () => {
167168 resolution : { width : 1024 , height : 768 , fullscreen : true } ,
168169 }
169170
170- const instance = createInstanceFromOptions ( payload , mockVersionProvider )
171+ const instance = createInstance ( payload , getCandidatePath , mockVersionProvider )
171172
172173 expect ( instance . resolution ) . toEqual ( { width : 1024 , height : 768 , fullscreen : true } )
173174 } )
@@ -293,7 +294,7 @@ describe('Instance Assignment Utils', () => {
293294 const changes = await computeInstanceEditChanges ( currentInstance , editOptions , async ( s ) => s )
294295
295296 expect ( changes . runtime ) . toEqual ( {
296- minecraft : '1.19.2 ' , // preserved from current
297+ minecraft : '1.20.1 ' , // preserved from current
297298 forge : '47.1.0' , // new value
298299 } )
299300 } )
@@ -411,7 +412,7 @@ describe('Instance Assignment Utils', () => {
411412 runtime : { minecraft : '1.19.2' , forge : '43.2.0' } ,
412413 }
413414
414- const instance = createInstanceFromOptions ( createOptions , mockProvider )
415+ const instance = createInstance ( createOptions , getCandidatePath , mockProvider )
415416
416417 // Compute edit changes
417418 const editOptions : EditInstanceOptions = {
@@ -427,7 +428,7 @@ describe('Instance Assignment Utils', () => {
427428 const updatedInstance = applyInstanceChanges ( instance , changes )
428429
429430 expect ( updatedInstance . name ) . toBe ( 'Updated Test Instance' )
430- expect ( updatedInstance . runtime . minecraft ) . toBe ( '1.19.2 ' ) // preserved from merge
431+ expect ( updatedInstance . runtime . minecraft ) . toBe ( '1.20.1 ' ) // preserved from merge
431432 expect ( updatedInstance . runtime . forge ) . toBe ( '43.2.0' ) // preserved
432433 expect ( updatedInstance . runtime . fabricLoader ) . toBe ( '0.14.21' ) // added
433434 expect ( updatedInstance . maxMemory ) . toBe ( 8192 )
0 commit comments