git.iko.soy/rowtype-yoga/purescript-yoga-react-native
on feature/macos-ios-support help sign in
20 lines 709 B history raw
1import { describe, it, expect } from "vitest";
2import { currentState, addEventListenerImpl, removeSubscription } from "../src/Yoga/React/Native/AppState.js";
4describe("AppState FFI", () => {
5 it("currentState returns a string", () => {
6 const state = currentState();
7 expect(typeof state).toBe("string");
8 });
10 it("addEventListenerImpl returns a subscription", () => {
11 const sub = addEventListenerImpl("change", (state) => {});
12 expect(sub).toBeDefined();
13 expect(typeof sub.remove).toBe("function");
14 });
16 it("removeSubscription calls remove", () => {
17 const sub = addEventListenerImpl("change", (state) => {});
18 expect(() => removeSubscription(sub)()).not.toThrow();
19 });
20});