← Commit history

tests: Codex 26.1111 tour hook (adom/codex#6)

John Lauer ·4d95ad9e96 · ·parent bd800c0
1 file changed +36
tests/test_walkthrough.py+36
@@ -49,5 +49,41 @@ assert.equal(signIn(),'sign in required');                 self.assertEqual(asset.read_text(), source)  +SOURCE_2611 = '''function Fha(){let{data:e,isLoading:t}=K(Nha),{authMethod:n}=Ru();if(kg?.ideOnboarding==null)return`none`;if(!t)return e?.completed||n==null?`none`:n===`chatgptAuthTokens`||n===`chatgpt`?`2025-09-15-full-chatgpt-auth`:`2025-09-15-apikey-auth`}'''+++class Walkthrough2611(unittest.TestCase):+    """adom/codex#6: Codex 26.1111.21308 reshaped the hook; the tour came back for new users."""+    def test_reshaped_hook_skips_tour_and_restores(self):+        with tempfile.TemporaryDirectory() as d:+            ext = Path(d)+            asset = ext / 'webview/assets/app-initial-test.js'+            asset.parent.mkdir(parents=True)+            asset.write_text(SOURCE_2611 + '\nfunction signIn(){return "sign in required"}')+            self.assertEqual(patch_tour(ext, atomic)['state'], 'skipped')+            first = asset.read_text()+            patch_tour(ext, atomic)+            self.assertEqual(first, asset.read_text())+            js = first + '''+const assert=require('node:assert/strict');+var kg={ideOnboarding:{}}, Nha='tour', result, method='chatgpt';+function K(){return result};function Ru(){return {authMethod:method}};+for(result of [{data:undefined,isLoading:false},{data:{completed:false},isLoading:false},{data:{completed:true},isLoading:false},{isLoading:true}]) assert.equal(Fha(),'none');+method='apikey'; result={data:{completed:false},isLoading:false}; assert.equal(Fha(),'none');+assert.equal(signIn(),'sign in required');+'''+            subprocess.run(['node', '-e', js], check=True)+            restore_tour(ext, atomic)+            self.assertEqual(asset.read_text(), SOURCE_2611 + '\nfunction signIn(){return "sign in required"}')++    def test_both_shapes_in_one_bundle_is_ambiguous(self):+        with tempfile.TemporaryDirectory() as d:+            ext = Path(d)+            asset = ext / 'webview/assets/app-initial-test.js'+            asset.parent.mkdir(parents=True)+            asset.write_text(SOURCE + SOURCE_2611)+            self.assertEqual(patch_tour(ext, atomic)['state'], 'unsupported')++ if __name__ == '__main__':     unittest.main()