Skip to content

Commit

Permalink
fix file path separator issue in prepare unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wedgberto committed Jan 20, 2021
1 parent 9c04d8d commit 4625c33
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/unit/prepare.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ describe('prepare', () => {
prepare = rewire('../../bin/templates/cordova/lib/prepare');
api = new Api();

initialJavaActivityPath = `${api.locations.javaSrc}/com/company/product/MainActivity.java`.replace(/\//g, '\\');
initialJavaActivityPath = path.join(api.locations.javaSrc, 'com/company/product/MainActivity.java');

cordovaProject = {
root: '/mock',
Expand Down Expand Up @@ -969,8 +969,8 @@ describe('prepare', () => {

it('moves CordovaActivity class java file to path that tracks the package name when package name changed', async () => {
packageName = 'com.company.renamed';
const renamedPath = `${api.locations.javaSrc}/${packageName.replace(/\./g, '/')}`.replace(/\//g, '\\');
const renamedJavaActivityPath = `${renamedPath}\\MainActivity.java`;
const renamedPath = path.join(api.locations.javaSrc, packageName.replace(/\./g, '/'));
const renamedJavaActivityPath = path.join(renamedPath, 'MainActivity.java');

await api.prepare(cordovaProject, options).then(() => {
expect(replaceFileContents).toHaveBeenCalledWith(renamedJavaActivityPath, /package [\w.]*;/, 'package ' + packageName + ';');
Expand Down

0 comments on commit 4625c33

Please sign in to comment.