1import {
2  getOrientation,
3  LANDSCAPE_ORIENTATIONS,
4  PORTRAIT_ORIENTATIONS,
5  setOrientation,
6} from '../Orientation';
7
8describe('orientation', () => {
9  it(`returns null if nothing is provided`, () => {
10    expect(getOrientation({})).toBe(null);
11  });
12
13  it(`returns the value if provided`, () => {
14    expect(getOrientation({ orientation: 'portrait' })).toBe('portrait');
15    expect(getOrientation({ orientation: 'landscape' })).toBe('landscape');
16  });
17
18  it(`sets to appropriate values`, () => {
19    expect(setOrientation({ orientation: 'portrait' }, {})).toMatchObject({
20      UISupportedInterfaceOrientations: PORTRAIT_ORIENTATIONS,
21    });
22
23    expect(setOrientation({ orientation: 'landscape' }, {})).toMatchObject({
24      UISupportedInterfaceOrientations: LANDSCAPE_ORIENTATIONS,
25    });
26
27    expect(setOrientation({}, {})).toMatchObject({
28      UISupportedInterfaceOrientations: [...PORTRAIT_ORIENTATIONS, ...LANDSCAPE_ORIENTATIONS],
29    });
30  });
31});
32