forked from Akirix/ts-convict
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from aBMania/master
fix empty config bug
- Loading branch information
Showing
3 changed files
with
42 additions
and
2 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
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,2 @@ | ||
export default class EmptyConfig { | ||
} |
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,38 @@ | ||
/** | ||
* @module test/models | ||
*/ | ||
import {suite, test} from "mocha-typescript"; | ||
import * as assert from "assert"; | ||
import "mocha"; | ||
import EmptyConfig from './EmptyConfig.model'; | ||
import {TSConvict} from '../../../index'; | ||
|
||
let tsConvict: TSConvict<EmptyConfig>; | ||
|
||
@suite('Test a config with only simple values') | ||
export class EmptyConfigTest { | ||
|
||
/** | ||
* Make a new one each and every test. | ||
*/ | ||
public before() { | ||
tsConvict = new TSConvict(EmptyConfig); | ||
} | ||
|
||
@test('Test getting an empty config') | ||
public validConfig() { | ||
const myValidConfig: EmptyConfig = tsConvict.load({}); | ||
// Make sure we got a proper serialized type back | ||
assert.strictEqual( | ||
(myValidConfig instanceof EmptyConfig), | ||
true, | ||
'Expected the config to be an instance of EmptyConfig' | ||
); | ||
|
||
assert.deepEqual( | ||
myValidConfig, | ||
{}, | ||
'Expected the config to be empty' | ||
); | ||
} | ||
} |