Skip to content

Commit 7a8c662

Browse files
authored
Merge pull request #453 from permaweb/rakis/spec
chore(hyperAOS): add test setup for hyper-aos using lua busted
2 parents 20f7143 + 3ef2bfd commit 7a8c662

File tree

7 files changed

+93
-414
lines changed

7 files changed

+93
-414
lines changed

hyper/README.md

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,75 @@
33
hyper AOS is a hyperBEAM based implementation of AOS, focused to deliver lighting fast performance to the AO network.
44

55

6+
## Developer Setup
67

7-
coming soon
8+
9+
* Install lua
10+
11+
```sh
12+
wget https://www.lua.org/ftp/lua-5.3.6.tar.gz
13+
tar -xzf lua-5.3.6.tar.gz
14+
cd lua-5.3.6
15+
```
16+
17+
For linux
18+
19+
```sh
20+
make linux
21+
```
22+
23+
For mac
24+
25+
```sh
26+
make macosx
27+
```
28+
29+
```sh
30+
sudo make install
31+
```
32+
33+
* Install luarocks
34+
35+
```sh
36+
wget https://luarocks.org/releases/luarocks-3.9.2.tar.gz
37+
tar -xzf luarocks-3.9.2.tar.gz
38+
cd luarocks-3.9.2
39+
```
40+
41+
```sh
42+
./configure --lua-version=5.3 --with-lua=/usr/local
43+
make
44+
sudo make install
45+
```
46+
47+
* Init lua env
48+
49+
```sh
50+
luarocks init
51+
```
52+
53+
* Install busted testing library
54+
55+
```sh
56+
luarocks install busted
57+
```
58+
59+
* Setup lua env
60+
61+
```sh
62+
eval $(luarocks path)
63+
```
64+
65+
## Tests
66+
67+
* Running Tests
68+
69+
```sh
70+
busted
71+
```
72+
73+
* Writing Tests
74+
75+
Add your test in the `spec` folder and name the test ending with `_spec.lua`
76+
77+

hyper/apm_modules/@rakis/test-unit/README.md

Lines changed: 0 additions & 83 deletions
This file was deleted.

hyper/apm_modules/@rakis/test-unit/apm.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

hyper/apm_modules/@rakis/test-unit/source.lua

Lines changed: 0 additions & 58 deletions
This file was deleted.

hyper/run_test.lua

Lines changed: 0 additions & 31 deletions
This file was deleted.

hyper/spec/utils_spec.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--[[
2+
hyper AOS unit tests
3+
4+
utils module
5+
6+
* matchesPattern
7+
]]
8+
local utils = require('src/utils')
9+
10+
describe("utils", function()
11+
describe("matchesSpec", function()
12+
it("should match action", function()
13+
assert.is_true(utils.matchesSpec({ action = "Balance"}, "Balance"))
14+
end)
15+
it("should match body.action", function()
16+
assert.is_true(utils.matchesSpec({ body = { action = "Balance"}}, "Balance"))
17+
end)
18+
it("should match body.method", function()
19+
assert.is_true(utils.matchesSpec({ body = { method = "beep"}}, { method = "beep"}))
20+
end)
21+
end)
22+
end)

0 commit comments

Comments
 (0)