xref: /expo/apps/test-suite/tests/Haptics.js (revision a47a1472)
1import * as Haptics from 'expo-haptics';
2
3export const name = 'Haptics';
4
5export async function test(t) {
6  t.describe('Haptics', async () => {
7    t.it('selectionAsync()', async () => {
8      const result = await Haptics.selectionAsync();
9      t.expect(result).toBeUndefined();
10    });
11
12    t.describe('notificationAsync()', async () => {
13      t.it('success', async () => {
14        const result = await Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
15        t.expect(result).toBeUndefined();
16      });
17
18      t.it('warning', async () => {
19        const result = await Haptics.notificationAsync(Haptics.NotificationFeedbackType.Warning);
20        t.expect(result).toBeUndefined();
21      });
22
23      t.it('error', async () => {
24        const result = await Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error);
25        t.expect(result).toBeUndefined();
26      });
27    });
28
29    t.describe('impactAsync()', async () => {
30      t.it('light', async () => {
31        const result = await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
32        t.expect(result).toBeUndefined();
33      });
34
35      t.it('medium', async () => {
36        const result = await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
37        t.expect(result).toBeUndefined();
38      });
39
40      t.it('heavy', async () => {
41        const result = await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy);
42        t.expect(result).toBeUndefined();
43      });
44    });
45  });
46}
47