(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7523],{6395:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/cli/test",function(){return s(81147)}])},20985:function(e,t,s){"use strict";s.d(t,{Z:function(){return o}});var r=s(52676),n=s(11234);let i={logo:function(){return(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.25em",fontSize:"32px",fontFamily:"PP Supply Mono",textTransform:"uppercase"},children:[(0,r.jsx)("img",{src:"/images/logos/mud-white.svg",style:{height:"calc(var(--nextra-navbar-height) - 35px)"},alt:"MUD logo"}),"MUD"]})},useNextSeoProps(){let{asPath:e}=(0,n.useRouter)();return{titleTemplate:"/"===e?"MUD – a framework for ambitious Ethereum applications":"%s – MUD"}},project:{link:"https://github.com/latticexyz/mud"},docsRepositoryBase:"https://github.com/latticexyz/mud/tree/main/docs",head:(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("meta",{property:"title",content:"MUD documentation"})}),darkMode:!1,nextThemes:{defaultTheme:"dark"},footer:{text:"MIT 2023 \xa9 MUD"},primaryHue:28,sidebar:{defaultMenuCollapseLevel:1}};var o=i},81147:function(e,t,s){"use strict";s.r(t),s.d(t,{__toc:function(){return l}});var r=s(52676),n=s(76085),i=s(7661),o=s(20985);s(38117);var a=s(24209);let l=[{depth:2,value:"Command line options",id:"command-line-options"},{depth:2,value:"Examples",id:"examples"},{depth:2,value:"Writing MUD tests",id:"writing-mud-tests"}];function _createMdxContent(e){let t=Object.assign({h1:"h1",p:"p",ol:"ol",li:"li",a:"a",code:"code",h2:"h2",table:"table",thead:"thead",tr:"tr",th:"th",tbody:"tbody",td:"td",pre:"pre",span:"span",details:"details",summary:"summary"},(0,a.a)(),e.components);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h1,{children:"mud test"}),"\n",(0,r.jsx)(t.p,{children:"This command runs the tests in a MUD project. Internally, it runs the following steps:"}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["Starts an ",(0,r.jsx)(t.a,{href:"https://book.getfoundry.sh/reference/anvil/",children:(0,r.jsx)(t.code,{children:"anvil"})})," instance.","\n","\n"]}),"\n",(0,r.jsxs)(t.li,{children:["Deploys the ",(0,r.jsx)(t.code,{children:"World"})," and all related ",(0,r.jsx)(t.code,{children:"System"}),"s using ",(0,r.jsx)(t.a,{href:"./deploy",children:(0,r.jsx)(t.code,{children:"mud deploy"})}),"."]}),"\n",(0,r.jsxs)(t.li,{children:["Runs tests using ",(0,r.jsx)(t.a,{href:"https://book.getfoundry.sh/forge/tests",children:(0,r.jsx)(t.code,{children:"forge test"})})," and passes the deployed world address to the tests via the ",(0,r.jsx)(t.code,{children:"WORLD_ADDRESS"})," environment variable."]}),"\n"]}),"\n",(0,r.jsx)(t.h2,{id:"command-line-options",children:"Command line options"}),"\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Option"}),(0,r.jsx)(t.th,{children:"Meaning"}),(0,r.jsx)(t.th,{children:"Type"}),(0,r.jsx)(t.th,{children:"Default value"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"--version"})}),(0,r.jsx)(t.td,{children:"Show version number"}),(0,r.jsx)(t.td,{children:"boolean"}),(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"false"})})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"--configPath"})}),(0,r.jsx)(t.td,{children:"Path to the config file"}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"mud.config.ts"})})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"--printConfig"})}),(0,r.jsx)(t.td,{children:"Print the resolved config"}),(0,r.jsx)(t.td,{children:"boolean"}),(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"false"})})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"--saveDeployment"})}),(0,r.jsx)(t.td,{children:"Save the deployment info to a file"}),(0,r.jsx)(t.td,{children:"boolean"}),(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"true"})})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"--profile"})}),(0,r.jsx)(t.td,{children:"The foundry profile to use"}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"local"})})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"--srcDir"})}),(0,r.jsx)(t.td,{children:"Source directory"}),(0,r.jsx)(t.td,{children:"string"}),(0,r.jsxs)(t.td,{children:["Foundry ",(0,r.jsx)(t.code,{children:"src"})," directory"]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"--skipBuild"})}),(0,r.jsx)(t.td,{children:"Skip rebuilding the contracts before deploying"}),(0,r.jsx)(t.td,{children:"boolean"}),(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"false"})})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"--alwaysRunPostDeploy"})}),(0,r.jsxs)(t.td,{children:["Run ",(0,r.jsx)(t.code,{children:"PostDeploy.s.sol"})," after each deploy"]}),(0,r.jsx)(t.td,{children:"boolean"}),(0,r.jsxs)(t.td,{children:[(0,r.jsx)(t.code,{children:"false"})," (run the script only when deploying a new ",(0,r.jsx)(t.code,{children:"World"}),")"]})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"--port"})}),(0,r.jsxs)(t.td,{children:["Port for the testing ",(0,r.jsx)(t.code,{children:"anvil"})," instance"]}),(0,r.jsx)(t.td,{children:"number"}),(0,r.jsx)(t.td,{children:"4242"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"--help"})}),(0,r.jsx)(t.td,{children:"Show help"}),(0,r.jsx)(t.td,{children:"boolean"}),(0,r.jsx)(t.td,{children:(0,r.jsx)(t.code,{children:"false"})})]})]})]}),"\n",(0,r.jsx)(t.h2,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.pre,{"data-language":"sh","data-theme":"default",hasCopyCode:!0,children:(0,r.jsx)(t.code,{"data-language":"sh","data-theme":"default",children:(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"pnpm"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-string)"},children:"mud"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-string)"},children:"test"})]})})}),"\n",(0,r.jsx)(t.h2,{id:"writing-mud-tests",children:"Writing MUD tests"}),"\n",(0,r.jsxs)(t.p,{children:["MUD test contracts inherit from ",(0,r.jsx)(t.a,{href:"https://github.com/latticexyz/mud/blob/main/packages/world/test/MudTest.t.sol",children:(0,r.jsx)(t.code,{children:"MudTest"})}),".\nThis contract gets the ",(0,r.jsx)(t.code,{children:"World"})," address from the ",(0,r.jsx)(t.code,{children:"$WORLD_ADDRESS"})," environment variable and sets it as the ",(0,r.jsx)(t.code,{children:"Store"})," address."]}),"\n",(0,r.jsxs)(t.details,{children:[(0,r.jsx)(t.summary,{children:"Line by line explanation of a test"}),(0,r.jsxs)(t.p,{children:["This is an explanation of ",(0,r.jsx)(t.a,{href:"https://github.com/latticexyz/mud/blob/main/templates/react/packages/contracts/test/TasksTest.t.sol",children:"the test"})," for the ",(0,r.jsx)(t.a,{href:"https://github.com/latticexyz/mud/tree/main/templates/react",children:"React template"})," contracts."]}),(0,r.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,r.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,r.jsx)(t.span,{className:"line",children:(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-comment)"},children:"// SPDX-License-Identifier: MIT"})}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"pragma"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:"solidity"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" >=0.8.21;"})]}),"\n",(0,r.jsx)(t.span,{className:"line",children:" "}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"forge-std/Test.sol"'}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"MudTest"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"@latticexyz/world/test/MudTest.t.sol"'}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})]})}),(0,r.jsx)(t.p,{children:"Import the general definitions required in all MUD tests."}),(0,r.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,r.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"IWorld"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"../src/codegen/world/IWorld.sol"'}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"import"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" { "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"Tasks"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:", "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"TasksData"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" } "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"from"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"../src/codegen/index.sol"'}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:";"})]})]})}),(0,r.jsxs)(t.p,{children:["Import the definitions required for this test, the ",(0,r.jsx)(t.code,{children:"World"})," we can access and the tables we'll use."]}),(0,r.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,r.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"contract"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"TasksTest"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"is"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"MudTest"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"testWorldExists"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"public"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]})]})}),(0,r.jsxs)(t.p,{children:["MUD tests are ",(0,r.jsx)(t.a,{href:"https://book.getfoundry.sh/forge/tests",children:"Foundry tests"}),".\nAny public function that starts with ",(0,r.jsx)(t.code,{children:"test"})," is a test that gets executed."]}),(0,r.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,r.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"uint256"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" codeSize;"})]}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"address"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" addr "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" worldAddress;"})]})]})}),(0,r.jsxs)(t.p,{children:["The ",(0,r.jsx)(t.code,{children:"World"})," address comes from the ",(0,r.jsx)(t.a,{href:"https://github.com/latticexyz/mud/blob/main/packages/world/test/MudTest.t.sol#L11",children:(0,r.jsx)(t.code,{children:"MudTest"})}),"."]}),(0,r.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,r.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"assembly"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"      codeSize "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:":="}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"extcodesize"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(addr)"})]}),"\n",(0,r.jsx)(t.span,{className:"line",children:(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    }"})}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"assertTrue"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(codeSize "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:">"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,r.jsx)(t.span,{className:"line",children:(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  }"})})]})}),(0,r.jsxs)(t.p,{children:["Use ",(0,r.jsx)(t.a,{href:"https://www.evm.codes/#3b?fork=shanghai",children:(0,r.jsx)(t.code,{children:"extcodesize"})})," to get the size of the ",(0,r.jsx)(t.code,{children:"World"})," contract.\nIf the deploy process failed, there wouldn't be any code there."]}),(0,r.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,r.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"function"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"testTasks"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"() "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"public"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" {"})]}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-comment)"},children:"// Expect task to exist that we created during PostDeploy script"})]}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    TasksData "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"memory"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" task "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-keyword)"},children:"="}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" Tasks."}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"get"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"1"'}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})]})]})}),(0,r.jsx)(t.p,{children:"Use the structure for a table entry's values that is created as part of code generation."}),(0,r.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,r.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"assertEq"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(task.description"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"Walk the dog"'}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})]}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"assertEq"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(task.completedAt"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-constant)"},children:"0"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})]})]})}),(0,r.jsxs)(t.p,{children:["Verify the information that is prepopulated by ",(0,r.jsxs)(t.a,{href:"https://github.com/latticexyz/mud/blob/main/templates/react/packages/contracts/script/PostDeploy.s.sol",children:["the ",(0,r.jsx)(t.code,{children:"PostDeploy.s.sol"})," script"]}),"."]}),(0,r.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,r.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-comment)"},children:"// Expect the task to be completed after calling completeTask from our TasksSystem"})]}),"\n",(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"IWorld"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(worldAddress)."}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"completeTask"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"1"'}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:");"})]})]})}),(0,r.jsxs)(t.p,{children:["Call a ",(0,r.jsx)(t.code,{children:"System"})," to modify the table data."]}),(0,r.jsx)(t.pre,{"data-language":"solidity","data-theme":"default",children:(0,r.jsxs)(t.code,{"data-language":"solidity","data-theme":"default",children:[(0,r.jsxs)(t.span,{className:"line",children:[(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"    "}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"assertEq"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"(Tasks."}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-function)"},children:"getCompletedAt"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"("}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-string-expression)"},children:'"1"'}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:")"}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-token-punctuation)"},children:","}),(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:" block.timestamp);"})]}),"\n",(0,r.jsx)(t.span,{className:"line",children:(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"  }"})}),"\n",(0,r.jsx)(t.span,{className:"line",children:(0,r.jsx)(t.span,{style:{color:"var(--shiki-color-text)"},children:"}"})})]})}),(0,r.jsx)(t.p,{children:"Verify that the call changed the data correctly."})]})]})}let d={MDXContent:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:t}=Object.assign({},(0,a.a)(),e.components);return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(_createMdxContent,{...e})}):_createMdxContent(e)},pageOpts:{filePath:"pages/cli/test.mdx",route:"/cli/test",timestamp:1715695015e3,pageMap:[{kind:"Meta",data:{introduction:{title:"What is MUD?",theme:{breadcrumb:!1}},quickstart:{title:"Get started",theme:{breadcrumb:!1}},protocol:{title:"Protocol",type:"separator"},store:"Store",world:"World",framework:{title:"Framework",type:"separator"},config:"Config",cli:"CLI","state-query":"State Query",services:"Services","---":{title:"",type:"separator"},guides:"Guides",templates:"Templates",contribute:{title:"Contribute",theme:{breadcrumb:!1}},changelog:"Changelog",retrospectives:"Retrospectives",audits:"Audits",version:{title:"2.0.10",type:"menu",items:{changelog:{title:"Changelog",href:"/changelog"},contribute:{title:"Contribute",href:"/contribute"}}},status:{title:"Status",type:"page",href:"https://status.mud.dev",newWindow:!0},community:{title:"Community",type:"page",href:"https://community.mud.dev",newWindow:!0},twitter:{title:"Twitter",type:"page",href:"https://twitter.com/latticexyz",newWindow:!0},discord:{title:"Discord",type:"page",href:"https://lattice.xyz/discord",newWindow:!0}}},{kind:"Folder",name:"audits",route:"/audits",children:[{kind:"MdxPage",name:"2024-02-11-open-zeppelin",route:"/audits/2024-02-11-open-zeppelin"},{kind:"Meta",data:{"2024-02-11-open-zeppelin":"2024-02-11 OpenZeppelin",pdf:{display:"hidden"},icons:{display:"hidden"}}}]},{kind:"MdxPage",name:"changelog",route:"/changelog"},{kind:"Folder",name:"cli",route:"/cli",children:[{kind:"Meta",data:{tablegen:"mud tablegen",worldgen:"mud worldgen",test:"mud test",deploy:"mud deploy",verify:"mud verify","dev-contracts":"mud dev-contracts","abi-ts":"mud abi-ts","set-version":"mud set-version"}},{kind:"MdxPage",name:"abi-ts",route:"/cli/abi-ts"},{kind:"MdxPage",name:"deploy",route:"/cli/deploy"},{kind:"MdxPage",name:"dev-contracts",route:"/cli/dev-contracts"},{kind:"MdxPage",name:"set-version",route:"/cli/set-version"},{kind:"MdxPage",name:"tablegen",route:"/cli/tablegen"},{kind:"MdxPage",name:"test",route:"/cli/test"},{kind:"MdxPage",name:"verify",route:"/cli/verify"},{kind:"MdxPage",name:"worldgen",route:"/cli/worldgen"}]},{kind:"MdxPage",name:"config",route:"/config"},{kind:"MdxPage",name:"contribute",route:"/contribute"},{kind:"Folder",name:"guides",route:"/guides",children:[{kind:"Meta",data:{"replicating-onchain-state":"Replicating onchain state","hello-world":"Hello World","extending-a-world":"Extending a World","adding-delegation":"Adding Delegation",emojimon:"Emojimon","best-practices":"Best Practices"}},{kind:"MdxPage",name:"adding-delegation",route:"/guides/adding-delegation"},{kind:"Folder",name:"best-practices",route:"/guides/best-practices",children:[{kind:"Meta",data:{"system-best-practices":"System Best Practices"}},{kind:"MdxPage",name:"system-best-practices",route:"/guides/best-practices/system-best-practices"}]},{kind:"Folder",name:"emojimon",route:"/guides/emojimon",children:[{kind:"MdxPage",name:"1-preface-the-ecs-model",route:"/guides/emojimon/1-preface-the-ecs-model"},{kind:"MdxPage",name:"2-getting-started",route:"/guides/emojimon/2-getting-started"},{kind:"MdxPage",name:"3-players-and-movement",route:"/guides/emojimon/3-players-and-movement"},{kind:"MdxPage",name:"4-map-and-terrain",route:"/guides/emojimon/4-map-and-terrain"},{kind:"MdxPage",name:"5-a-wild-emojimon-appears",route:"/guides/emojimon/5-a-wild-emojimon-appears"},{kind:"MdxPage",name:"6-advanced",route:"/guides/emojimon/6-advanced"},{kind:"Meta",data:{"1-preface-the-ecs-model":"Preface: the ECS model","2-getting-started":"Getting started","3-players-and-movement":"Players and movement","4-map-and-terrain":"Map and terrain","5-a-wild-emojimon-appears":"A wild Emojimon appears","6-advanced":"Advanced features"}}]},{kind:"MdxPage",name:"emojimon",route:"/guides/emojimon"},{kind:"Folder",name:"extending-a-world",route:"/guides/extending-a-world",children:[{kind:"Meta",data:{index:"Extending a World Permissionlessly"}},{kind:"MdxPage",name:"index",route:"/guides/extending-a-world"}]},{kind:"Folder",name:"hello-world",route:"/guides/hello-world",children:[{kind:"Meta",data:{"add-table":"Add a table","filter-sync":"Filter data synchronization","add-system":"Add a system",deploy:{title:"Deploy to a blockchain",href:"/cli/deploy"}}},{kind:"MdxPage",name:"add-system",route:"/guides/hello-world/add-system"},{kind:"MdxPage",name:"add-table",route:"/guides/hello-world/add-table"},{kind:"MdxPage",name:"filter-sync",route:"/guides/hello-world/filter-sync"}]},{kind:"MdxPage",name:"hello-world",route:"/guides/hello-world"},{kind:"MdxPage",name:"replicating-onchain-state",route:"/guides/replicating-onchain-state"}]},{kind:"MdxPage",name:"introduction",route:"/introduction"},{kind:"MdxPage",name:"quickstart",route:"/quickstart"},{kind:"Folder",name:"retrospectives",route:"/retrospectives",children:[{kind:"MdxPage",name:"2023-09-12-register-system-vulnerability",route:"/retrospectives/2023-09-12-register-system-vulnerability"},{kind:"MdxPage",name:"2024-04-17-storeread-getdynamicfieldlength-bug",route:"/retrospectives/2024-04-17-storeread-getdynamicfieldlength-bug"},{kind:"Meta",data:{"2024-04-17-storeread-getdynamicfieldlength-bug":"2024-04-17 StoreRead.getDynamicFieldLength bug","2023-09-12-register-system-vulnerability":"2023-09-12 registerSystem vulnerability"}}]},{kind:"Folder",name:"services",route:"/services",children:[{kind:"Meta",data:{indexer:"Indexer",faucet:"Faucet"}},{kind:"MdxPage",name:"faucet",route:"/services/faucet"},{kind:"MdxPage",name:"indexer",route:"/services/indexer"}]},{kind:"Folder",name:"state-query",route:"/state-query",children:[{kind:"Meta",data:{typescript:"TypeScript"}},{kind:"Folder",name:"typescript",route:"/state-query/typescript",children:[{kind:"Meta",data:{recs:"RECS",zustand:"Zustand"}},{kind:"MdxPage",name:"recs",route:"/state-query/typescript/recs"},{kind:"MdxPage",name:"zustand",route:"/state-query/typescript/zustand"}]}]},{kind:"Folder",name:"store",route:"/store",children:[{kind:"Meta",data:{introduction:"Introduction","data-model":"Data model",tables:"Tables","table-libraries":"Table libraries",encoding:"Encoding","store-hooks":"Store hooks",reference:"Reference"}},{kind:"MdxPage",name:"data-model",route:"/store/data-model"},{kind:"MdxPage",name:"encoding",route:"/store/encoding"},{kind:"MdxPage",name:"introduction",route:"/store/introduction"},{kind:"Folder",name:"reference",route:"/store/reference",children:[{kind:"Meta",data:{"store-core":"StoreCore (internal)",store:"IStore (external)","store-hook":"StoreHook",misc:"Miscellaneous"}},{kind:"MdxPage",name:"misc",route:"/store/reference/misc"},{kind:"MdxPage",name:"store-core",route:"/store/reference/store-core"},{kind:"MdxPage",name:"store-hook",route:"/store/reference/store-hook"},{kind:"MdxPage",name:"store",route:"/store/reference/store"}]},{kind:"MdxPage",name:"store-hooks",route:"/store/store-hooks"},{kind:"MdxPage",name:"table-libraries",route:"/store/table-libraries"},{kind:"MdxPage",name:"tables",route:"/store/tables"}]},{kind:"Folder",name:"templates",route:"/templates",children:[{kind:"Meta",data:{typescript:"TypeScript",godot:"Godot",pwa:"Progressive Web App (for mobile)",swift:"Swift",svelte:"Svelte",unity:"Unity"}},{kind:"MdxPage",name:"godot",route:"/templates/godot"},{kind:"MdxPage",name:"pwa",route:"/templates/pwa"},{kind:"MdxPage",name:"svelte",route:"/templates/svelte"},{kind:"MdxPage",name:"swift",route:"/templates/swift"},{kind:"Folder",name:"typescript",route:"/templates/typescript",children:[{kind:"Meta",data:{contracts:"Contracts",vanilla:"Vanilla","react-ecs":"React-ECS",threejs:"Three.js",vue:"Vue"}},{kind:"MdxPage",name:"contracts",route:"/templates/typescript/contracts"},{kind:"MdxPage",name:"react-ecs",route:"/templates/typescript/react-ecs"},{kind:"MdxPage",name:"threejs",route:"/templates/typescript/threejs"},{kind:"MdxPage",name:"vanilla",route:"/templates/typescript/vanilla"},{kind:"MdxPage",name:"vue",route:"/templates/typescript/vue"}]},{kind:"MdxPage",name:"unity",route:"/templates/unity"}]},{kind:"Folder",name:"world",route:"/world",children:[{kind:"Meta",data:{introduction:"Introduction","resource-ids":"Resource Identifiers","namespaces-access-control":"Namespaces & Access Control",tables:"Tables",systems:"Systems","system-hooks":"System Hooks","function-selectors":"Function Selectors",balance:"Balance","account-delegation":"Account Delegation","batch-calls":"Batch Calls",upgrades:"Upgrading",modules:"Modules",reference:"Reference"}},{kind:"MdxPage",name:"account-delegation",route:"/world/account-delegation"},{kind:"MdxPage",name:"balance",route:"/world/balance"},{kind:"MdxPage",name:"batch-calls",route:"/world/batch-calls"},{kind:"MdxPage",name:"function-selectors",route:"/world/function-selectors"},{kind:"MdxPage",name:"introduction",route:"/world/introduction"},{kind:"Folder",name:"modules",route:"/world/modules",children:[{kind:"Meta",data:{keyswithvalue:"Keys with Value"}},{kind:"MdxPage",name:"keyswithvalue",route:"/world/modules/keyswithvalue"}]},{kind:"MdxPage",name:"modules",route:"/world/modules"},{kind:"MdxPage",name:"namespaces-access-control",route:"/world/namespaces-access-control"},{kind:"Folder",name:"reference",route:"/world/reference",children:[{kind:"Meta",data:{"delegation-external":"Delegation (interface)",module:"Modules","module-external":"Modules (interface)",system:"Systems","system-external":"Systems (interface)",world:"World","world-external":"World (interfaces)","world-context":"World context","world-context-external":"World context (interface)","resource-ids":"Resource IDs",misc:"Miscellaneous",internal:"Internals"}},{kind:"MdxPage",name:"delegation-external",route:"/world/reference/delegation-external"},{kind:"Folder",name:"internal",route:"/world/reference/internal",children:[{kind:"Meta",data:{"access-control":"Access Control",create:"Create2",delegation:"Delegation",erc165:"ERC165","erc165-external":"ERC165 (interface)","init-module":"Init Module","init-module-implementation":"Init Module Implementation",systemcall:"SystemCall"}},{kind:"MdxPage",name:"access-control",route:"/world/reference/internal/access-control"},{kind:"MdxPage",name:"create",route:"/world/reference/internal/create"},{kind:"MdxPage",name:"delegation",route:"/world/reference/internal/delegation"},{kind:"MdxPage",name:"erc165-external",route:"/world/reference/internal/erc165-external"},{kind:"MdxPage",name:"erc165",route:"/world/reference/internal/erc165"},{kind:"MdxPage",name:"init-module-implementation",route:"/world/reference/internal/init-module-implementation"},{kind:"MdxPage",name:"init-module",route:"/world/reference/internal/init-module"},{kind:"MdxPage",name:"systemcall",route:"/world/reference/internal/systemcall"}]},{kind:"MdxPage",name:"misc",route:"/world/reference/misc"},{kind:"MdxPage",name:"module-external",route:"/world/reference/module-external"},{kind:"MdxPage",name:"module",route:"/world/reference/module"},{kind:"MdxPage",name:"resource-ids",route:"/world/reference/resource-ids"},{kind:"MdxPage",name:"system-external",route:"/world/reference/system-external"},{kind:"MdxPage",name:"system",route:"/world/reference/system"},{kind:"MdxPage",name:"world-context-external",route:"/world/reference/world-context-external"},{kind:"MdxPage",name:"world-context",route:"/world/reference/world-context"},{kind:"MdxPage",name:"world-external",route:"/world/reference/world-external"},{kind:"MdxPage",name:"world",route:"/world/reference/world"}]},{kind:"MdxPage",name:"resource-ids",route:"/world/resource-ids"},{kind:"MdxPage",name:"system-hooks",route:"/world/system-hooks"},{kind:"MdxPage",name:"systems",route:"/world/systems"},{kind:"MdxPage",name:"tables",route:"/world/tables"},{kind:"MdxPage",name:"upgrades",route:"/world/upgrades"}]}],flexsearch:{codeblocks:!0},title:"mud test",headings:l},pageNextRoute:"/cli/test",nextraLayout:i.ZP,themeConfig:o.Z};t.default=(0,n.j)(d)},45184:function(){}},function(e){e.O(0,[6090,9774,2888,179],function(){return e(e.s=6395)}),_N_E=e.O()}]);