xref: /expo/apps/test-suite/tests/KeepAwake.js (revision cd4bd26b)
1import * as KeepAwake from 'expo-keep-awake';
2
3export const name = 'KeepAwake';
4
5export async function test(
6  { it, describe, beforeAll, jasmine, afterAll, expect, afterEach, beforeEach },
7  { setPortalChild, cleanupPortal }
8) {
9  describe(name, () => {
10    afterAll(async () => {
11      await KeepAwake.deactivateKeepAwake();
12      await KeepAwake.deactivateKeepAwake('test-tag');
13    });
14
15    it(`keeps the screen on`, async () => {
16      await KeepAwake.activateKeepAwake();
17    });
18    it(`keeps the screen on with a tag`, async () => {
19      await KeepAwake.activateKeepAwake('test-tag');
20    });
21    it(`enables screen timeout`, async () => {
22      await KeepAwake.deactivateKeepAwake();
23    });
24    it(`enables screen timeout with a tag`, async () => {
25      await KeepAwake.deactivateKeepAwake('test-tag');
26    });
27  });
28}
29