diff --git a/packages/create-lz-oapp/test/config.test.ts b/packages/create-lz-oapp/test/config.test.ts index 6fc46539d..6bf8d2e02 100644 --- a/packages/create-lz-oapp/test/config.test.ts +++ b/packages/create-lz-oapp/test/config.test.ts @@ -51,5 +51,17 @@ describe('config', () => { expect(getExamples()).toContainEqual(expect.objectContaining({ id: 'oft-solana' })) }) + + it('should not include OApp Read example if LZ_ENABLE_READ_EXAMPLE is empty', () => { + process.env.LZ_ENABLE_READ_EXAMPLE = '' + + expect(getExamples()).not.toContainEqual(expect.objectContaining({ id: 'oapp-read' })) + }) + + it('should include OApp Read example if LZ_ENABLE_READ_EXAMPLE is defined', () => { + process.env.LZ_ENABLE_READ_EXAMPLE = 'yes' + + expect(getExamples()).toContainEqual(expect.objectContaining({ id: 'oapp-read' })) + }) }) }) diff --git a/tests-user/tests/create-lz-oapp.bats b/tests-user/tests/create-lz-oapp.bats index a70d0d633..b23eda414 100644 --- a/tests-user/tests/create-lz-oapp.bats +++ b/tests-user/tests/create-lz-oapp.bats @@ -178,6 +178,15 @@ teardown() { pnpm test } +@test "should work with pnpm & oapp read example in CI mode" { + local DESTINATION="$PROJECTS_DIRECTORY/pnpm-oapp-read" + + LZ_ENABLE_READ_EXAMPLE=1 npx --yes create-lz-oapp --ci --example oapp-read --destination $DESTINATION --package-manager pnpm + cd "$DESTINATION" + pnpm compile + pnpm test +} + @test "should work with yarn & oapp example in CI mode" { local DESTINATION="$PROJECTS_DIRECTORY/yarn-oapp" @@ -242,6 +251,15 @@ teardown() { yarn test } +@test "should work with yarn & oapp read example in CI mode" { + local DESTINATION="$PROJECTS_DIRECTORY/yarn-oapp-read" + + YARN_CACHE_FOLDER="/tmp/.yarn-cache-oapp-read" LZ_ENABLE_READ_EXAMPLE=1 npx --yes create-lz-oapp --ci --example oapp-read --destination $DESTINATION --package-manager yarn + cd "$DESTINATION" + pnpm compile + pnpm test +} + @test "should work with npm & oapp example in CI mode" { local DESTINATION="$PROJECTS_DIRECTORY/npm-oapp" @@ -305,3 +323,12 @@ teardown() { npm run compile npm run test } + +@test "should work with npm & oapp read example in CI mode" { + local DESTINATION="$PROJECTS_DIRECTORY/npm-oapp-read" + + LZ_ENABLE_READ_EXAMPLE=1 npx --yes create-lz-oapp --ci --example oapp-read --destination $DESTINATION --package-manager npm + cd "$DESTINATION" + pnpm compile + pnpm test +} \ No newline at end of file diff --git a/turbo.json b/turbo.json index 091e440e8..d0e9915bd 100644 --- a/turbo.json +++ b/turbo.json @@ -48,6 +48,7 @@ "LZ_ENABLE_EXPERIMENTAL_RETRY", "LZ_ENABLE_EXPERIMENTAL_SIMULATION", "LZ_ENABLE_EXPERIMENTAL_SOLANA_OFT_EXAMPLE", + "LZ_ENABLE_READ_EXAMPLE", "LAYERZERO_EXAMPLES_REPOSITORY_URL", "LAYERZERO_EXAMPLES_REPOSITORY_REF",