From c16c6f52d78ada2f2ed4529207f768bf1406d16b Mon Sep 17 00:00:00 2001 From: Mykola Mokhnach Date: Thu, 12 Dec 2024 12:58:27 +0100 Subject: [PATCH] bind driver --- test/unit/commands/file-movement-specs.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/test/unit/commands/file-movement-specs.js b/test/unit/commands/file-movement-specs.js index 3bd48d3f1..c7dd94a28 100644 --- a/test/unit/commands/file-movement-specs.js +++ b/test/unit/commands/file-movement-specs.js @@ -1,5 +1,6 @@ import {parseContainerPath} from '../../../lib/commands/file-movement'; import {tempDir} from 'appium/support'; +import XCUITestDriver from '../../../lib/driver'; describe('file-movement', function () { @@ -16,9 +17,19 @@ describe('file-movement', function () { }); describe('parseContainerPath', function () { + let driver; + + beforeEach(function () { + driver = new XCUITestDriver(); + }); + + afterEach(function () { + driver = null; + }); + it('should parse with container', async function () { const mntRoot = await tempDir.openDir(); - const {bundleId, pathInContainer, containerType} = await parseContainerPath( + const {bundleId, pathInContainer, containerType} = await parseContainerPath.bind(driver)( '@io.appium.example:app/Documents/file.txt', mntRoot, ); @@ -29,7 +40,7 @@ describe('file-movement', function () { }); it('should parse with container root', async function () { const mntRoot = await tempDir.openDir(); - const {bundleId, pathInContainer, containerType} = await parseContainerPath( + const {bundleId, pathInContainer, containerType} = await parseContainerPath.bind(driver)( '@io.appium.example:documents/', mntRoot, ); @@ -40,7 +51,7 @@ describe('file-movement', function () { }); it('should parse without container', async function () { const mntRoot = await tempDir.openDir(); - const {bundleId, pathInContainer, containerType} = await parseContainerPath( + const {bundleId, pathInContainer, containerType} = await parseContainerPath.bind(driver)( '@io.appium.example/Documents/file.txt', mntRoot, ); @@ -51,7 +62,7 @@ describe('file-movement', function () { }); it('should raise an error if no container path', async function () { const mntRoot = await tempDir.openDir(); - await parseContainerPath('@io.appium.example:documents', mntRoot).should.be.rejected; + await parseContainerPath.bind(driver)('@io.appium.example:documents', mntRoot).should.be.rejected; }); }); });