Files
openhuman/app/src/utils/semver.test.ts
T
Mega MindandGitHub 5551e1e0aa Fix/365 enforce latest oauth gate from 351 (#421)
* feat: display app version in settings panel

* fix(onboarding): auto-refresh accessibility state after grant (#351)

* style(onboarding): apply formatter for issue #351 fix

* fix(onboarding): ESLint + typed mock for ScreenPermissionsStep; clear flag in handler

Consolidate tauriCommands imports and drop redundant mock cast.

Handle granted accessibility in focus/visibility callback instead of a follow-up effect.

Made-with: Cursor

* fix(release): gate OAuth deep links on minimum app version (#365)

- Add semver helpers and VITE_MINIMUM_SUPPORTED_APP_VERSION / download URL in app config
- Block openhuman://oauth/success when desktop build is below minimum; enqueue error,
  open latest-release URL, dispatch oauth:stale-app
- Pass new Vite env vars through release.yml and build-windows.yml Build frontend
- Document policy in docs/RELEASE_POLICY.md; note vars in app/.env.example

Closes #365

Made-with: Cursor

* fix: import React in SkillSetupWizard component

* fix: address CodeRabbit review (OAuth gate, semver, logging)

- Anchor semver regex to full string; arrow-style exports; tests for bad inputs
- Never throw from evaluateOAuthAppVersionGate; try/catch in deep link + omit raw URL from error logs
- Document build-time vs runtime policy in config JSDoc and RELEASE_POLICY
- Remove unused React import in SkillSetupWizard (tsc)

Made-with: Cursor

* fix: CodeRabbit — fail-closed OAuth gate, tauri-action Vite env, runbook

- Block OAuth when minimum is set but getVersion fails or version is unparseable
- Pass VITE_MINIMUM_* through tauri-action env (release + Windows) so bundles match yarn build
- Expand RELEASE_POLICY: artifact retirement, dual workflow env note
- Friendlier copy when current version is unknown

Made-with: Cursor
2026-04-08 04:26:19 +05:30

27 lines
1017 B
TypeScript

import { describe, expect, it } from 'vitest';
import { compareSemver, isVersionAtLeast, parseSemverParts } from './semver';
describe('semver', () => {
it('rejects malformed or suffixed versions (full-string match)', () => {
expect(parseSemverParts('0.51.x')).toBeNull();
expect(parseSemverParts('1.2beta')).toBeNull();
expect(parseSemverParts('0.51.0foo')).toBeNull();
expect(parseSemverParts('0.51.0-rc.1')).toBeNull();
expect(parseSemverParts('0.51.0')).not.toBeNull();
});
it('compares dotted versions', () => {
expect(compareSemver('0.46.0', '0.47.0')).toBeLessThan(0);
expect(compareSemver('0.47.0', '0.47.0')).toBe(0);
expect(compareSemver('0.48.0', '0.47.0')).toBeGreaterThan(0);
expect(compareSemver('v1.2.3', '1.2.3')).toBe(0);
});
it('isVersionAtLeast', () => {
expect(isVersionAtLeast('0.47.0', '0.47.0')).toBe(true);
expect(isVersionAtLeast('0.48.0', '0.47.0')).toBe(true);
expect(isVersionAtLeast('0.46.0', '0.47.0')).toBe(false);
});
});