Skip to content

Commit

Permalink
chore: tests updates (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
ya7on authored Oct 29, 2024
1 parent e338a12 commit 9a5bbd0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 27 deletions.
8 changes: 4 additions & 4 deletions scripts/deployJettonMaster.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Builder, toNano } from '@ton/core';
import { beginCell, Builder, toNano } from '@ton/core';
import { JettonMaster } from '../wrappers/JettonMaster';
import { NetworkProvider } from '@ton/blueprint';

Expand Down Expand Up @@ -26,9 +26,9 @@ export async function run(provider: NetworkProvider) {
{
$$type: 'JettonInit',
query_id: 0n,
jetton_name: new Builder().storeStringRefTail('Jetton name').asSlice(),
jetton_description: new Builder().storeStringRefTail('Long' + ' long '.repeat(100) + 'description').asSlice(),
jetton_symbol: new Builder().storeStringRefTail('SMBL').asSlice(),
jetton_name: beginCell().storeStringRefTail('Jetton name').asSlice(),
jetton_description: beginCell().storeStringRefTail('Long' + ' long '.repeat(100) + 'description').asSlice(),
jetton_symbol: beginCell().storeStringRefTail('SMBL').asSlice(),
max_supply: toNano(1337),
}
);
Expand Down
50 changes: 34 additions & 16 deletions tests/JettonMaster.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ describe('JettonMaster', () => {
{
$$type: 'JettonInit',
query_id: 0n,
jetton_name: new Builder().storeStringTail(JETTON_NAME).asSlice(),
jetton_description: new Builder().storeStringTail(JETTON_DESCRIPTION).asSlice(),
jetton_symbol: new Builder().storeStringTail(JETTON_SYMBOL).asSlice(),
jetton_name: beginCell().storeStringTail(JETTON_NAME).asSlice(),
jetton_description: beginCell().storeStringTail(JETTON_DESCRIPTION).asSlice(),
jetton_symbol: beginCell().storeStringTail(JETTON_SYMBOL).asSlice(),
max_supply: JETTON_MAX_SUPPLY,
}
);
Expand Down Expand Up @@ -178,9 +178,9 @@ describe('JettonMaster', () => {
{
$$type: 'JettonInit',
query_id: 0n,
jetton_name: new Builder().storeStringTail(JETTON_NAME).asSlice(),
jetton_description: new Builder().storeStringTail(JETTON_DESCRIPTION).asSlice(),
jetton_symbol: new Builder().storeStringTail(JETTON_SYMBOL).asSlice(),
jetton_name: beginCell().storeStringTail(JETTON_NAME).asSlice(),
jetton_description: beginCell().storeStringTail(JETTON_DESCRIPTION).asSlice(),
jetton_symbol: beginCell().storeStringTail(JETTON_SYMBOL).asSlice(),
max_supply: JETTON_MAX_SUPPLY,
}
);
Expand All @@ -204,9 +204,9 @@ describe('JettonMaster', () => {
{
$$type: 'JettonInit',
query_id: 0n,
jetton_name: new Builder().storeStringTail(JETTON_NAME).asSlice(),
jetton_description: new Builder().storeStringTail(JETTON_DESCRIPTION).asSlice(),
jetton_symbol: new Builder().storeStringTail(JETTON_SYMBOL).asSlice(),
jetton_name: beginCell().storeStringTail(JETTON_NAME).asSlice(),
jetton_description: beginCell().storeStringTail(JETTON_DESCRIPTION).asSlice(),
jetton_symbol: beginCell().storeStringTail(JETTON_SYMBOL).asSlice(),
max_supply: JETTON_MAX_SUPPLY,
}
);
Expand All @@ -230,8 +230,8 @@ describe('JettonMaster', () => {
},
{
$$type: 'JettonSetParameter',
key: "jetton_name",
value: new Builder().storeStringTail(UPDATED_JETTON_NAME).asSlice()
key: "name",
value: beginCell().storeStringTail(UPDATED_JETTON_NAME).asSlice()
}
);
expect(nameUpdateResult.transactions).toHaveTransaction({
Expand All @@ -250,8 +250,8 @@ describe('JettonMaster', () => {
},
{
$$type: 'JettonSetParameter',
key: "jetton_description",
value: new Builder().storeStringTail(UPDATED_JETTON_DESCRIPTION).asSlice()
key: "description",
value: beginCell().storeStringTail(UPDATED_JETTON_DESCRIPTION).asSlice()
}
);
expect(descriptionUpdateResult.transactions).toHaveTransaction({
Expand All @@ -270,8 +270,8 @@ describe('JettonMaster', () => {
},
{
$$type: 'JettonSetParameter',
key: "jetton_symbol",
value: new Builder().storeStringTail(UPDATED_JETTON_SYMBOL).asSlice()
key: "symbol",
value: beginCell().storeStringTail(UPDATED_JETTON_SYMBOL).asSlice()
}
);
expect(symbolUpdateResult.transactions).toHaveTransaction({
Expand All @@ -291,7 +291,7 @@ describe('JettonMaster', () => {
{
$$type: 'JettonSetParameter',
key: "max_supply",
value: new Builder().storeCoins(UPDATED_JETTON_MAX_SUPPLY).asSlice()
value: beginCell().storeCoins(UPDATED_JETTON_MAX_SUPPLY).asSlice()
}
);
expect(maxSupplyUpdateResult.transactions).toHaveTransaction({
Expand All @@ -305,6 +305,24 @@ describe('JettonMaster', () => {
// Checks
let jettonMasterMetadata = await jettonMaster.getGetJettonData();
expect(jettonMasterMetadata.mintable).toEqual(false);
let jettonContent = jettonMasterMetadata.jetton_content.beginParse();
expect(jettonContent.loadUint(8)).toEqual(0);
let metadataDict = jettonContent.loadDict(Dictionary.Keys.BigUint(256), Dictionary.Values.Cell());
expect(
metadataDict.get(59089242681608890680090686026688704441792375738894456860693970539822503415433n)
).toEqualCell(
beginCell().storeUint(0, 8).storeStringTail(UPDATED_JETTON_NAME).endCell()
);
expect(
metadataDict.get(82961397245523513629401799123410942652413991882008909918554405086738284660097n)
).toEqualCell(
beginCell().storeUint(0, 8).storeStringTail(UPDATED_JETTON_SYMBOL).endCell()
);
expect(
metadataDict.get(90922719342317012409671596374183159143637506542604000676488204638996496437508n)
).toEqualCell(
beginCell().storeUint(0, 8).storeStringTail(UPDATED_JETTON_DESCRIPTION).endCell()
);
// TODO metadata
});

Expand Down
14 changes: 7 additions & 7 deletions tests/JettonWallet.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Blockchain, SandboxContract, TreasuryContract } from '@ton/sandbox';
import { Builder, toNano } from '@ton/core';
import { beginCell, Builder, toNano } from '@ton/core';
import { JettonWallet } from '../build/Jetton/tact_JettonWallet';
import { JettonMaster } from '../build/Jetton/tact_JettonMaster';
import '@ton/test-utils';
Expand Down Expand Up @@ -35,9 +35,9 @@ describe('JettonMaster', () => {
{
$$type: 'JettonInit',
query_id: 0n,
jetton_name: new Builder().storeStringTail(JETTON_NAME).asSlice(),
jetton_description: new Builder().storeStringTail(JETTON_DESCRIPTION).asSlice(),
jetton_symbol: new Builder().storeStringTail(JETTON_SYMBOL).asSlice(),
jetton_name: beginCell().storeStringTail(JETTON_NAME).asSlice(),
jetton_description: beginCell().storeStringTail(JETTON_DESCRIPTION).asSlice(),
jetton_symbol: beginCell().storeStringTail(JETTON_SYMBOL).asSlice(),
max_supply: JETTON_MAX_SUPPLY,
}
);
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('JettonMaster', () => {
amount: toNano("228"),
destination: other.address,
custom_payload: null,
forward_payload: new Builder().asSlice(),
forward_payload: beginCell().asSlice(),
forward_ton_amount: 1n,
response_destination: other.address,
}
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('JettonMaster', () => {
amount: toNano("228"),
destination: other.address,
custom_payload: null,
forward_payload: new Builder().asSlice(),
forward_payload: beginCell().asSlice(),
forward_ton_amount: 0n,
response_destination: other.address,
}
Expand Down Expand Up @@ -147,7 +147,7 @@ describe('JettonMaster', () => {
amount: toNano("100500"),
destination: other.address,
custom_payload: null,
forward_payload: new Builder().asSlice(),
forward_payload: beginCell().asSlice(),
forward_ton_amount: 0n,
response_destination: other.address,
}
Expand Down

0 comments on commit 9a5bbd0

Please sign in to comment.