You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`algorand-typescript-testing` is a companion package to [Algorand Typescript](https://github.com/algorandfoundation/puya-ts/tree/main/packages/algo-ts) that enables efficient unit testing of Algorand TypeScript smart contracts in an offline environment. This package emulates key AVM behaviors without requiring a network connection, offering fast and reliable testing capabilities with a familiar TypeScript interface.
8
+
`algorand-typescript-testing` is a companion package to [Algorand Typescript](https://github.com/algorandfoundation/puya-ts/tree/main/packages/algo-ts) that enables efficient unit testing of Algorand TypeScript smart contracts in an offline environment. This package emulates key AVM behaviours without requiring a network connection, offering fast and reliable testing capabilities with a familiar TypeScript interface.
9
9
10
10
The `algorand-typescript-testing` package provides:
11
11
@@ -46,7 +46,7 @@ Let's write a simple contract and test it using the `algorand-typescript-testing
46
46
47
47
`algorand-typescript-testing` includes a TypeScript transformer (`puyaTsTransformer`) that ensures contracts (with `.algo.ts` extension) and tests (with `.algo.spec.ts` or `.algo.test.ts` extensions) behave consistently between Node.js and AVM environments.
48
48
49
-
The transformer replicates AVM behavior, such as integer-only arithmetic where `3 / 2` produces `1`. For code requiring standard Node.js behaviour (e.g., `3 / 2` produces `1.5`), place it in separate `.ts` files and reference them from test files.
49
+
The transformer replicates AVM behaviour, such as integer-only arithmetic where `3 / 2` produces `1`. For code requiring standard Node.js behaviour (e.g., `3 / 2` produces `1.5`), place it in separate `.ts` files and reference them from test files.
50
50
51
51
The transformer also redirects `@algorandfoundation/algorand-typescript` imports to `@algorandfoundation/algorand-typescript-testing/internal` to provide executable implementations of Algorand TypeScript constructs like `Global`, `Box`, `Uint64`, and `clone`.
52
52
@@ -302,6 +302,6 @@ To dig deeper into the capabilities of `algorand-typescript-testing`, continue w
Copy file name to clipboardExpand all lines: docs/algots.md
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,10 @@ title: Algorand TypeScript
4
4
5
5
# Algorand TypeScript
6
6
7
-
Algorand TypeScript is a partial implementation of the TypeScript programming language that runs on the Algorand Virtual Machine (AVM). It includes a statically typed framework for development of Algorand smart contracts and logic signatures, with TypeScript interfaces to underlying AVM functionality that works with standard TypeScript tooling.
7
+
Algorand TypeScript is a partial implementation of the TypeScript programming language that runs on the Algorand Virtual Machine (AVM). It includes a statically typed framework for developing Algorand smart contracts and logic signatures, and provides TypeScript interfaces to underlying AVM functionality that work with standard TypeScript tooling.
8
8
9
-
It maintains the syntax and semantics of TypeScript such that a developer who knows TypeScript can make safe assumptions
10
-
about the behaviour of the compiled code when running on the AVM. Algorand TypeScript is also executable TypeScript that can be run
11
-
and debugged on a Node.js virtual machine with transpilation to EcmaScript and run from automated tests.
9
+
It preserves the syntax and semantics of TypeScript so that a developer who knows TypeScript can make safe assumptions about the behaviour of the compiled code when running on the AVM. Algorand TypeScript is also executable TypeScript that can be run and debugged on Node.js after transpilation to ECMAScript and run from automated tests.
12
10
13
-
Algorand TypeScript is compiled for execution on the AVM by PuyaTs, a TypeScript frontend for the [Puya](https://github.com/algorandfoundation/puya) optimising compiler that ensures the resulting AVM bytecode execution semantics that match the given TypeScript code. PuyaTs produces output that is directly compatible with AlgoKit typed clients to make deployment and calling easy.
11
+
Algorand TypeScript is compiled for execution on the AVM by PuyaTs, a TypeScript frontend for the [Puya](https://github.com/algorandfoundation/puya) optimising compiler. PuyaTs ensures the resulting AVM bytecode has execution semantics that match the given TypeScript code, and it produces output that is directly compatible with AlgoKit typed clients to simplify deployment and invocation.
Copy file name to clipboardExpand all lines: docs/api.md
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,7 @@ title: API Reference
6
6
7
7
An overview of the `algorand-typescript-testing` package - covering the main classes and functions.
8
8
9
-
```
10
-
Spotted a typo in documentation? This project is open source, please submit an issue or a PR on [GitHub](https://github.com/algorandfoundation/algorand-typescript-testing).
11
-
```
9
+
> Spotted a typo in the documentation? This project is open source; please submit an issue or a PR on [GitHub](https://github.com/algorandfoundation/algorand-typescript-testing).
Copy file name to clipboardExpand all lines: docs/coverage.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Coverage
4
4
5
5
# Coverage
6
6
7
-
See which `algorand-typescript` stubs are implemented by the `algorand-typescript-testing` library. See the [Concepts](tg-concepts.md#types-of-algorand-typescript-stub-implementations) section for more details on the implementation categories. Refer to the [`algorand-typescript` stubs API](api.md) for the full list of the stubs for which the `algorand-typescript-testing` library provides implementations referenced in the table below.
7
+
See which `algorand-typescript` stubs are implemented in the `algorand-typescript-testing` library. See the [Concepts](tg-concepts.md#types-of-algorand-typescript-stub-implementations) section for more details on the implementation categories. Refer to the [`algorand-typescript-testing`API](api.md) for a full list of stubs implemented by the `algorand-typescript-testing` library, as referenced in the table below.
Copy file name to clipboardExpand all lines: docs/faq.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ title: FAQ
6
6
7
7
## What is a Test Context?
8
8
9
-
A Test Context is a context manager that provides a simulated Algorand environment for testing TypeScript smart contracts. It allows developers to create and manipulate a virtual Algorand ecosystem for testing purposes. For more details, see the [Test Context section](tg-concepts.md#test-context) in our documentation.
9
+
A test context is a context manager that provides a simulated Algorand environment for testing TypeScript smart contracts. It allows developers to create and manipulate a virtual Algorand ecosystem for testing purposes. For more details, see the [Test Context section](tg-concepts.md#test-context) in our documentation.
10
10
11
11
## What is the Algorand Virtual Machine (AVM)?
12
12
@@ -18,7 +18,7 @@ Operational Codes, or opcodes, are AVM instructions that are executed directly b
18
18
19
19
## What are Value Generators?
20
20
21
-
Value Generators are helper methods that generate randomized values for testing when the specific value of the tested type is not important. In the context of Algorand TypeScript testing, these are represented by property on the context manager, accessed via `any.*` (`any.txn.*`, or `any.arc4.*`. in the case of ARC 4 types). To understand how to use Value Generators effectively, check out our [Value Generators section](tg-concepts.md#value-generators) in the documentation.
21
+
Value Generators are helper methods that generate randomized values for testing when the specific value of the tested type is not important. In the context of Algorand TypeScript testing, these are represented by properties on the context manager, accessed via `any.*` (`any.txn.*` or `any.arc4.*` in the case of ARC 4 types). To understand how to use Value Generators effectively, check out our [Value Generators section](tg-concepts.md#value-generators) in the documentation.
22
22
23
23
## What are the limitations of the Algorand TypeScript Testing framework?
24
24
@@ -30,7 +30,7 @@ The Algorand TypeScript Testing framework emulates the Algorand Virtual Machine
30
30
4. Certain cryptographic operations are mocked or simplified
31
31
5. No state proof generation or verification
32
32
33
-
For scenarios where these limitations are crucial, it's recommended to pair this framework with integration testing. If you have a solid reason to justify introducing new emulated behaviour, please open an issue or contribute to the project on [Github](https://github.com/algorandfoundation/algorand-typescript-testing).
33
+
For scenarios where these limitations are crucial, it's recommended to pair this framework with integration testing. If you have a good reason to suggest new emulated behaviour, please open an issue or contribute to the project on [GitHub](https://github.com/algorandfoundation/algorand-typescript-testing).
34
34
35
35
## How does balance tracking work in the testing framework?
36
36
@@ -50,16 +50,16 @@ Some cryptographic operations are mocked or simplified in the framework. For a d
50
50
51
51
## Can I use this framework for security-critical validations?
52
52
53
-
While this framework is useful for unit testing and local development, it should not be the only tool used for security-critical validations or performance benchmarking. It's designed to approximate AVM behavior for common scenarios. Always complement your testing with additional integration testing options available in `algokit`, where you can test against real localnet or testnet environments.
53
+
While this framework is useful for unit testing and local development, it should not be the only tool used for security-critical validations or performance benchmarking. It's designed to approximate AVM behaviour for common scenarios. Always complement your testing with additional integration testing options available in `algokit`, where you can test against real localnet or testnet environments.
54
54
55
55
## Is there an example of how to use this framework alongside integration tests?
56
56
57
-
Yes, the `algokit-typescript-template`, accessible via `algokit init`, provides a working example of how to structure `algorand-typecript-testing` along with regular integration tests against localnet.
57
+
Yes, the `algokit-typescript-template`, accessible via `algokit init`, provides a working example of how to structure `algorand-typescript-testing` along with regular integration tests against localnet.
58
58
59
59
```
60
-
An `algokit-typescript-template` accessible via `algokit init -t typescript`, provides a comprehensive and customizable working example of how to structure `algorand-typescript-testing` along with regular integration tests against localnet.
60
+
The `algokit-typescript-template` accessible via `algokit init -t typescript` provides a comprehensive and customizable working example of how to structure `algorand-typescript-testing` along with regular integration tests against localnet.
61
61
```
62
62
63
63
## Is it compatible with `vitest`?
64
64
65
-
Yes, it is compatible with `vitest` and _any_ other TypeScript testing framework as its agnostic of the testing framework as long as it's TypeScript. If you spot incompatibility with a certain tool, please open an issue or contribute to the project on [Github](https://github.com/algorandfoundation/algorand-typescript-testing).
65
+
Yes, it is compatible with `vitest` and _any_ other TypeScript testing framework as its agnostic of the testing framework as long as it's TypeScript. If you spot incompatibility with a certain tool, please open an issue or contribute to the project on [GitHub](https://github.com/algorandfoundation/algorand-typescript-testing).
0 commit comments