Skip to content

Commit 9050e07

Browse files
authored
Make Project Management list*Apps() integration tests more robust. (#438)
Search through the list of apps on a project to find the ones created by these integration tests, rather than just using the first returned results.
1 parent c48e6ad commit 9050e07

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

test/integration/project-management.spec.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,29 @@ describe('admin.projectManagement', () => {
4949

5050
describe('listAndroidApps()', () => {
5151
it('successfully lists Android apps', () => {
52-
return admin.projectManagement().listAndroidApps().then((results) => {
53-
expect(results.length).to.be.at.least(1);
54-
expect(results[0].appId).to.equal(androidApp.appId);
55-
});
52+
return admin.projectManagement().listAndroidApps()
53+
.then((apps) => Promise.all(apps.map((app) => app.getMetadata())))
54+
.then((metadatas) => {
55+
expect(metadatas.length).to.be.at.least(1);
56+
const metadataOwnedByTest =
57+
metadatas.find((metadata) => isIntegrationTestApp(metadata.packageName));
58+
expect(metadataOwnedByTest).to.exist;
59+
expect(metadataOwnedByTest.appId).to.equal(androidApp.appId);
60+
});
5661
});
5762
});
5863

5964
describe('listIosApps()', () => {
6065
it('successfully lists iOS apps', () => {
61-
return admin.projectManagement().listIosApps().then((results) => {
62-
expect(results.length).to.be.at.least(1);
63-
expect(results[0].appId).to.equal(iosApp.appId);
64-
});
66+
return admin.projectManagement().listIosApps()
67+
.then((apps) => Promise.all(apps.map((app) => app.getMetadata())))
68+
.then((metadatas) => {
69+
expect(metadatas.length).to.be.at.least(1);
70+
const metadataOwnedByTest =
71+
metadatas.find((metadata) => isIntegrationTestApp(metadata.bundleId));
72+
expect(metadataOwnedByTest).to.exist;
73+
expect(metadataOwnedByTest.appId).to.equal(iosApp.appId);
74+
});
6575
});
6676
});
6777

0 commit comments

Comments
 (0)