shim-tests

in #shim23 days ago (edited)
Shim Tests

Hive Shim Test Suite

Gherkin-style tests for LocalStorage, IndexedDB, and Hive Keychain

<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
    (html comment removed:  Gherkin Editor )
    <div>
        <h2 class="text-lg font-semibold mb-3">Feature Definition</h2>
        <textarea id="feature" class="w-full h-96 bg-zinc-900 border border-zinc-700 rounded-3xl p-6 font-mono text-sm" spellcheck="false">

Feature: Hive Shim Compatibility

Scenario: LocalStorage should work through the shim
Given the app is loaded through the hive-shim
When I set localStorage item "testKey" to "Hello from shim"
Then localStorage.getItem("testKey") should return "Hello from shim"

Scenario: LocalStorage persistence across reloads
Given localStorage has key "persistTest"
When I reload the app
Then localStorage.getItem("persistTest") should still exist

Scenario: hive_keychain.requestBroadcast should work
Given hive_keychain is available
When I call requestBroadcast with a test operation
Then the operation should be forwarded to the parent shim

Scenario: IndexedDB (Expected to fail currently)
Given the app tries to open an IndexedDB
Then it should either work or gracefully degrade

    (html comment removed:  Test Runner )
    <div>
        <div class="flex justify-between mb-3">
            <h2 class="text-lg font-semibold">Test Results</h2>
            <button onclick="runTests()" 
                    class="bg-emerald-600 hover:bg-emerald-500 px-6 py-2 rounded-2xl font-medium">
                ▶️ Run Tests
            </button>
        </div>
        
        <div id="results" class="bg-zinc-900 border border-zinc-700 rounded-3xl p-6 min-h-[500px] overflow-auto text-sm font-mono"></div>
    </div>
</div>