Skip to content

Commit

Permalink
feat(bindgen): Generate typescript demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Jul 11, 2023
1 parent d40a036 commit 0aca9cb
Show file tree
Hide file tree
Showing 33 changed files with 6,714 additions and 433 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ packages/compress-stringify/emscripten-build/
packages/compress-stringify/wasi-build/
packages/compress-stringify/typescript/demo/
packages/compress-stringify/typescript/dist/
packages/compress-stringify/typescript/test/browser/demo-app/public
packages/compress-stringify/typescript/demo-app

node_modules
.DS_Store
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pytest
import sys

if sys.version_info < (3,10):
pytest.skip("Skipping pyodide tests on older Python", allow_module_level=True)

from pytest_pyodide import run_in_pyodide

from itkwasm_compress_stringify_emscripten import __version__ as test_package_version

@pytest.fixture
def package_wheel():
return f"itkwasm_compress_stringify_emscripten-{test_package_version}-py3-none-any.whl"

@run_in_pyodide(packages=['micropip'])
async def test_example(selenium, package_wheel):
import micropip
await micropip.install(package_wheel)

# Write your test code here
Binary file not shown.
Binary file not shown.
8 changes: 4 additions & 4 deletions packages/compress-stringify/typescript/build/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { viteStaticCopy } from 'vite-plugin-static-copy'
import path from 'path'

export default defineConfig({
root: path.join('test', 'browser'),
root: path.join('test', 'browser', 'demo-app'),
build: {
outDir: '../../demo',
outDir: '../../../demo-app',
emptyOutDir: true,
},
plugins: [
// put lazy loaded JavaScript and Wasm bundles in dist directory
viteStaticCopy({
targets: [
{ src: '../../dist/pipelines/*', dest: 'pipelines' },
{ src: '../../dist/web-workers/*', dest: 'web-workers' },
{ src: '../../../dist/pipelines/*', dest: 'pipelines' },
{ src: '../../../dist/web-workers/*', dest: 'web-workers' },
],
})
],
Expand Down
10 changes: 6 additions & 4 deletions packages/compress-stringify/typescript/cypress/e2e/spec.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ describe('@itk-wasm/compress-stringify', () => {
it('compressStringify runs sample inputs and produces expected outputs', () => {
cy.visit(demoServer)

cy.get('#compressStringifyInputs sl-button[name=loadSample]').click()
cy.get('#compressStringifyInputs sl-button[name=loadSampleInputs]').click()

cy.get('#compressStringifyInputs form').submit()

cy.get('#compressStringifyOutputs sl-textarea[name=output]').should('have.value', 'data:application/iwi+cbor+zstd;base64,KLUv/SAEIQAA3q2+7w==')
cy.get('#compressStringifyOutputs sl-textarea[name=output]').should('have.value', '100,97,116,97,58,97,112,112,108,105,99,97,116,105,111,110,47,105,119,105,43,99,98,111,114,43,122,115,116,100,59,98,97,115,101,54,52,44,75,76,85,118,47,83,65,69,73,81,65,65,51,113,50,43,55,119,61,61 ...')
})

it('parseStringDecompress runs sample inputs and produces expected outputs', () => {
cy.visit(demoServer)

cy.get('#parseStringDecompressInputs sl-button[name=loadSample]').click()
cy.get('sl-tab[panel="parseStringDecompress-panel"]').click()

cy.get('#parseStringDecompressInputs sl-button[name=loadSampleInputs]').click()

cy.get('#parseStringDecompressInputs form').submit()

cy.get('#parseStringDecompressOutputs sl-textarea[name=output]').should('have.value', '222,173,190,239')
cy.get('#parseStringDecompressOutputs sl-textarea[name=output]').should('have.value', '222,173,190,239 ...')
})
})
12 changes: 12 additions & 0 deletions packages/compress-stringify/typescript/cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../tsconfig.json",
"include": [
"**/*.ts"
],
"compilerOptions": {
"noEmit": false,
"sourceMap": false,
"inlineSourceMap": true,
"types": ["cypress"]
},
}
Loading

0 comments on commit 0aca9cb

Please sign in to comment.