This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow test suites to override entries in cnd's config file
With the addition of the [tokens] section, cnd fails to start up in `--dev` mode if the config file provided doesn't define a contract address.
- Loading branch information
1 parent
e2eaea2
commit 48e1060
Showing
9 changed files
with
146 additions
and
18 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
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
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,61 @@ | ||
import { extractCndConfigOverrides } from "../src/test_environment"; | ||
|
||
describe("extractCndConfigOverrides", () => { | ||
test("given no overrides, returns empty object", () => { | ||
expect(extractCndConfigOverrides({})).toStrictEqual({}); | ||
expect( | ||
extractCndConfigOverrides({ | ||
cndConfigOverride: null, | ||
}) | ||
).toStrictEqual({}); | ||
expect( | ||
extractCndConfigOverrides({ | ||
cndConfigOverride: "", | ||
}) | ||
).toStrictEqual({}); | ||
expect( | ||
extractCndConfigOverrides({ | ||
cndConfigOverride: ["", "", ""], | ||
}) | ||
).toStrictEqual({}); | ||
}); | ||
|
||
test("given overrides, sets nested key", () => { | ||
const overrides = { | ||
cndConfigOverride: | ||
"ethereum.tokens.dai = 0x0000000000000000000000000000000000000000", | ||
}; | ||
|
||
const config = extractCndConfigOverrides(overrides); | ||
|
||
expect(config).toStrictEqual({ | ||
ethereum: { | ||
tokens: { | ||
dai: "0x0000000000000000000000000000000000000000", | ||
}, | ||
}, | ||
}); | ||
}); | ||
|
||
test("given two overrides, sets them both", () => { | ||
const overrides = { | ||
cndConfigOverride: [ | ||
"ethereum.tokens.dai = 0x0000000000000000000000000000000000000000", | ||
"bitcoin.network = regtest", | ||
], | ||
}; | ||
|
||
const config = extractCndConfigOverrides(overrides); | ||
|
||
expect(config).toStrictEqual({ | ||
ethereum: { | ||
tokens: { | ||
dai: "0x0000000000000000000000000000000000000000", | ||
}, | ||
}, | ||
bitcoin: { | ||
network: "regtest", | ||
}, | ||
}); | ||
}); | ||
}); |
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