-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwithRNOrientationAppDelegate.spec.ts
More file actions
54 lines (44 loc) · 1.88 KB
/
withRNOrientationAppDelegate.spec.ts
File metadata and controls
54 lines (44 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import * as fs from 'node:fs';
import * as path from 'node:path';
import {
objCFileUpdater,
swiftFileUpdater,
} from '../src/withRNOrientationAppDelegate';
describe('withRNOrientationAppDelegate', function () {
beforeEach(function () {
jest.resetAllMocks();
});
it('updates the AppDelegate.mm with both header import and method implementation', async function () {
const appDelegatePath = path.join(__dirname, './fixtures/AppDelegate.mm');
const appDelegate = await fs.promises.readFile(appDelegatePath, 'utf-8');
const result = objCFileUpdater(appDelegate);
expect(result).toMatchSnapshot();
});
it('updates the AppDelegate52.swift with the method implementation having public override when sdk is <= 52', async function () {
const appDelegatePath = path.join(
__dirname,
'./fixtures/AppDelegate52.swift'
);
const appDelegate = await fs.promises.readFile(appDelegatePath, 'utf-8');
const result = swiftFileUpdater(appDelegate, '52.0.0');
expect(result).toMatchSnapshot();
});
it('updates the AppDelegate53.swift with the method implementation without public override when sdk is equal to 53', async function () {
const appDelegatePath = path.join(
__dirname,
'./fixtures/AppDelegate53.swift'
);
const appDelegate = await fs.promises.readFile(appDelegatePath, 'utf-8');
const result = swiftFileUpdater(appDelegate, '53.0.0');
expect(result).toMatchSnapshot();
});
it('updates the AppDelegate53.swift with the method implementation having public override when sdk is greater than or equal to 54', async function () {
const appDelegatePath = path.join(
__dirname,
'./fixtures/AppDelegate53.swift'
);
const appDelegate = await fs.promises.readFile(appDelegatePath, 'utf-8');
const result = swiftFileUpdater(appDelegate, '54.0.0');
expect(result).toMatchSnapshot();
});
});