Skip to content

Commit

Permalink
Clean up based on review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuester committed Oct 10, 2024
1 parent 4e2d6f8 commit b87d083
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions test/e2e/cht-conf-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const getProjectDirectory = (projectName = DEFAULT_PROJECT_NAME) => path.resolve

const runChtConf = async (
command,
{ url, sessionToken } = {},
projectName = DEFAULT_PROJECT_NAME
{ url, sessionToken, projectName = DEFAULT_PROJECT_NAME } = {},
) => {
const instanceUrl = url || await getProjectUrl(projectName);
const sessionParam = sessionToken ? `--session-token=${sessionToken}` : '';
Expand Down Expand Up @@ -56,7 +55,7 @@ const initProject = async (projectName = DEFAULT_PROJECT_NAME) => {
}, null, 4),
);

await runChtConf('initialise-project-layout', projectName);
await runChtConf('initialise-project-layout', { projectName });
};

const writeBaseAppSettings = async (baseSettings, projectName = DEFAULT_PROJECT_NAME) => {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/session-token.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {
getProjectDirectory, runChtConf,
} = require('./cht-conf-utils');

const COUCH_URL_PATTERN = /^(https?:\/\/)([^:]+):([^@]+)@(.*)$/;
const COUCH_URL_PATTERN = /^(?<prefix>https?:\/\/)(?<user>[^:]+):(?<password>[^@]+)@(?<rootUrl>.*)$/;

const projectPath = getProjectDirectory();

Expand Down Expand Up @@ -68,7 +68,7 @@ describe('session-token', () => {
await createProjectPath();
initializeDatabase();
authenticatedUrl = await getProjectUrl();
const [, prefix, user, password, rootUrl] = authenticatedUrl.match(COUCH_URL_PATTERN);
const { prefix, user, password, rootUrl } = authenticatedUrl.match(COUCH_URL_PATTERN).groups;
unauthenticatedUrl = `${prefix}${rootUrl}`;
sessionToken = await getSessionToken(user, password);
});
Expand Down
2 changes: 1 addition & 1 deletion test/fn/compile-app-settings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@ describe('compile-app-settings', () => {
.excludingEvery(['rules', 'contact_summary'])
.to.deep.eq(expected);
}
}).timeout(4000);
});
}
});
4 changes: 2 additions & 2 deletions test/fn/watch-project.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ describe('watch-project', () => {
.then(mockApi.getAppSettings)
.then((settings) => JSON.parse(settings.content))
.then((settings) => expect(settings.locale).equal('es'));
}).timeout(16000);
});

it('watch-project: convert app settings', () => {
const appSettingsPath = path.join(testDir, 'app_settings.json');
Expand All @@ -178,7 +178,7 @@ describe('watch-project', () => {
.then(messages => {
assert.deepEqual(messages.custom, { a: 'first', test: 'new' });
});
}).timeout(16000);
});

it('watch-project: upload resources', () => {
return watchWrapper(editResources, 'resources.json')
Expand Down

0 comments on commit b87d083

Please sign in to comment.