-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add bundleListing, customLookups, and customOutputs settings to…
- Loading branch information
1 parent
5690055
commit fcea642
Showing
33 changed files
with
921 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
graph default min time,graph default max time,model dat files | ||
0,100, | ||
graph default min time,graph default max time,model dat files,bundle listing,custom lookups,custom outputs | ||
0,100,,false,false,false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
graph default min time,graph default max time,model dat files | ||
0,100, | ||
graph default min time,graph default max time,model dat files,bundle listing,custom lookups,custom outputs | ||
0,100,,false,false,false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) 2024 Climate Interactive / New Venture Fund | ||
|
||
import { describe, expect, it } from 'vitest' | ||
|
||
import { loadConfig } from './config-loader' | ||
import { type UserConfig } from './user-config' | ||
|
||
function config(genFormat: string | undefined): UserConfig { | ||
return { | ||
...(genFormat ? { genFormat: genFormat as 'js' | 'c' } : {}), | ||
modelFiles: [], | ||
modelSpec: async () => { | ||
return { | ||
inputs: [], | ||
outputs: [] | ||
} | ||
} | ||
} | ||
} | ||
|
||
describe('config loader', () => { | ||
it('should resolve genFormat when left undefined', async () => { | ||
const userConfig = config(undefined) | ||
const result = await loadConfig('production', userConfig, '', '') | ||
if (result.isErr()) { | ||
throw new Error('Expected ok result but got: ' + result.error.message) | ||
} | ||
expect(result.value.resolvedConfig.genFormat).toBe('js') | ||
}) | ||
|
||
it('should resolve genFormat when set to js', async () => { | ||
const userConfig = config('js') | ||
const result = await loadConfig('production', userConfig, '', '') | ||
if (result.isErr()) { | ||
throw new Error('Expected ok result but got: ' + result.error.message) | ||
} | ||
expect(result.value.resolvedConfig.genFormat).toBe('js') | ||
}) | ||
|
||
it('should resolve genFormat when set to c', async () => { | ||
const userConfig = config('c') | ||
const result = await loadConfig('production', userConfig, '', '') | ||
if (result.isErr()) { | ||
throw new Error('Expected ok result but got: ' + result.error.message) | ||
} | ||
expect(result.value.resolvedConfig.genFormat).toBe('c') | ||
}) | ||
|
||
it('should fail if genFormat is invalid', async () => { | ||
const userConfig = config('JS') | ||
const result = await loadConfig('production', userConfig, '', '') | ||
if (result.isOk()) { | ||
throw new Error('Expected err result but got: ' + result.value) | ||
} | ||
expect(result.error.message).toBe(`The configured genFormat value is invalid; must be either 'js' or 'c'`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.