Skip to content

Commit

Permalink
bind driver
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Dec 12, 2024
1 parent 8c68d08 commit c16c6f5
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions test/unit/commands/file-movement-specs.js
Original file line number Diff line number Diff line change
@@ -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 () {
Expand All @@ -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,
);
Expand All @@ -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,
);
Expand All @@ -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,
);
Expand All @@ -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;
});
});
});

0 comments on commit c16c6f5

Please sign in to comment.