template_assets
Version:
 [](https://github.com/dfinity/examples/actions?query=workflow%3Amotoko-superheroes
47 lines (40 loc) • 1.43 kB
Plain Text
all: build
.SILENT: node_modules
node_modules:
npm install
.SILENT: build
build: node_modules
dfx canister create --all
dfx build
.SILENT: install
install: build
dfx canister install --all
.SILENT: upgrade
upgrade: build
dfx canister install --all --mode=upgrade
.SILENT: test
test: install
$(eval ID := $(shell dfx canister call superheroes create '(record {name = "Superman"; superpowers = opt record { 0 = "invulnerability"; 1 = opt record { 0 = "superhuman strength"; 1 = null; }; }; })' | tr -d '()'))
dfx canister call superheroes read '($(ID))' \
| grep 'Superman' && echo 'PASS'
dfx canister call superheroes update '($(ID), record {name = "Superman"; superpowers = opt record { 0 = "invulnerability"; 1 = opt record { 0 = "superhuman strength"; 1 = opt record { 0 = "flight"; 1 = opt record { 0 = "x-ray vision"; 1 = null; }; }; }; }; })' \
| grep 'true' && echo 'PASS'
dfx canister call superheroes read '($(ID))' \
| grep 'x-ray vision' && echo 'PASS'
dfx canister call superheroes delete '($(ID))' \
| grep 'true' && echo 'PASS'
dfx canister call superheroes delete '($(ID))' \
| grep 'false' && echo 'PASS'
dfx canister call superheroes read '($(ID))' \
| grep 'null' && echo 'PASS'
.SILENT: clean
clean:
rm -fr .dfx
rm -fr node_modules