|
1 | 1 | import tempy from 'tempy'; |
2 | 2 | import { join } from 'path'; |
3 | 3 | import { copy, pathExists, readFile, rm } from '@ionic/utils-fs'; |
4 | | -import { MobileProject } from '../src'; |
| 4 | +import { MobileProject, StringsFile, XCConfigFile, XmlFile } from '../src'; |
5 | 5 | import { MobileProjectConfig } from '../src/config'; |
6 | 6 | import { PlistFile } from '../src/plist'; |
7 | 7 |
|
@@ -381,6 +381,43 @@ describe('project - ios standard', () => { |
381 | 381 | const destContents = await readFile(dest); |
382 | 382 | expect(destContents.length).toBeGreaterThan(0); |
383 | 383 | }); |
| 384 | + |
| 385 | + it('should add source files when committing', async () => { |
| 386 | + const stringsFile = project.ios?.getProjectFile<StringsFile>( |
| 387 | + "NewStrings.strings", |
| 388 | + (filename: string) => new StringsFile(filename, project.vfs) |
| 389 | + ); |
| 390 | + await stringsFile?.load(); |
| 391 | + |
| 392 | + const xcconfigFile = project.ios?.getProjectFile<XCConfigFile>( |
| 393 | + "NewConfig.xcconfig", |
| 394 | + (filename: string) => new XCConfigFile(filename, project.vfs) |
| 395 | + ); |
| 396 | + await xcconfigFile?.load(); |
| 397 | + |
| 398 | + const plistFile = project.ios?.getProjectFile<PlistFile>( |
| 399 | + "NewPlist.plist", |
| 400 | + (filename: string) => new PlistFile(filename, project.vfs) |
| 401 | + ); |
| 402 | + await plistFile?.load(); |
| 403 | + |
| 404 | + /* |
| 405 | + const xmlFile = project.ios?.getProjectFile<XmlFile>( |
| 406 | + "NewXml.xml", |
| 407 | + (filename: string) => new XmlFile(filename, project.vfs) |
| 408 | + ); |
| 409 | + await xmlFile?.load(); |
| 410 | + */ |
| 411 | + |
| 412 | + await project.commit(); |
| 413 | + |
| 414 | + const pbx = project.ios?.getPbxProject(); |
| 415 | + expect(!!pbx?.hasFile('NewStrings.strings')).toBe(true); |
| 416 | + expect(!!pbx?.hasFile('NewConfig.xcconfig')).toBe(true); |
| 417 | + expect(!!pbx?.hasFile('NewPlist.plist')).toBe(true); |
| 418 | + // expect(!!pbx?.hasFile('NewXml.xml')).toBe(true); |
| 419 | + }); |
| 420 | + |
384 | 421 | }); |
385 | 422 |
|
386 | 423 | describe('ios - no info plist case', () => { |
|
0 commit comments