-
Notifications
You must be signed in to change notification settings - Fork 20
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 #1579 from ecadlabs/mk-1578-ligo-plugin-unit-tests
Mk 1578 ligo plugin unit tests
- Loading branch information
Showing
3 changed files
with
55 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { ___TEST___, ExprKind } from '../../../taqueria-plugin-ligo/compile'; | ||
|
||
describe('testing Ligo compile.ts getContractNameForExpr', () => { | ||
const { getContractNameForExpr } = ___TEST___; | ||
|
||
test('verify get contract name for storage type', () => { | ||
const exprKind: ExprKind = 'storage'; | ||
const sourceFile = 'token.storageList.mligo'; | ||
const contractName = getContractNameForExpr(sourceFile, exprKind); | ||
expect(contractName).toBe('token.mligo'); | ||
}); | ||
|
||
test('verify get contract name for default_storage type', () => { | ||
const exprKind: ExprKind = 'default_storage'; | ||
const sourceFile = 'token.storageList.mligo'; | ||
const contractName = getContractNameForExpr(sourceFile, exprKind); | ||
expect(contractName).toBe('token.mligo'); | ||
}); | ||
|
||
test('verify get contract name for parameter type', () => { | ||
const exprKind: ExprKind = 'parameter'; | ||
const sourceFile = 'token.parameterList.mligo'; | ||
const contractName = getContractNameForExpr(sourceFile, exprKind); | ||
expect(contractName).toBe('token.mligo'); | ||
}); | ||
|
||
test('verify get contract name fail case', () => { | ||
const { getContractNameForExpr } = ___TEST___; | ||
const sourceFile = 'IAmASourceFile'; | ||
try { | ||
const exprKind: ExprKind = 'storage'; | ||
const contractName = getContractNameForExpr(sourceFile, exprKind); | ||
expect(contractName).toBe('IAmASourceFile'); | ||
} catch (err) { | ||
const error = err as Error; | ||
if (error.message) { | ||
expect(error.message).toContain('Something went wrong internally'); | ||
} | ||
} | ||
}); | ||
}); |