Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
Signed-off-by: Diana Barsan <[email protected]>
  • Loading branch information
dianabarsan committed Dec 13, 2024
1 parent ee0dd58 commit e855fd7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 52 deletions.
35 changes: 0 additions & 35 deletions scripts/set-default-contact/.eslintrc

This file was deleted.

10 changes: 1 addition & 9 deletions scripts/set-default-contact/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,4 @@ End
* If a place had a contact set as default, but that contact was deleted, it is still considered as having a default contact already and will be skipped. The fix to this is to manually set the place to another contact and then unset that to be empty.
* If two users are assigned to the same place, the one that is processed first will be set. The second (or Nth) user will be skipped because the place will already have a user

## Development

This script has it's own ESLint rules found in the `.eslintrc` file. As of Dec 2022, the main difference is that it uses `ecmaVersion` of `8` instead of `6` like in `cht-core`. To ensure any changes comply, use this call before committing:

```shell
../../node_modules/.bin/eslint index.js
```

Otherwise, use Docker Helper to spin up a local instance to test against to ensure contacts are set as default for places when users have them both assigned.
Use Docker Helper to spin up a local instance to test against to ensure contacts are set as default for places when users have them both assigned.
25 changes: 17 additions & 8 deletions tests/e2e/upgrade/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ const MAIN_BRANCH = 'medic:medic:master';

const COMPOSE_FILES = ['cht-core', 'cht-couchdb'];
const getUpgradeServiceDockerCompose = async () => {
const response = await fetch('https://raw.githubusercontent.com/medic/cht-upgrade-service/main/docker-compose.yml');
const contents = await response.text();
if (response.ok) {
await fs.promises.writeFile(UPGRADE_SERVICE_DC, contents);
}
throw new Error(contents);
const contents = await utils.request({
uri: 'https://raw.githubusercontent.com/medic/cht-upgrade-service/main/docker-compose.yml',
json: false,
noAuth: true,
});
await fs.promises.writeFile(UPGRADE_SERVICE_DC, contents);
};

const getReleasesQuery = () => {
Expand All @@ -59,7 +59,12 @@ const getRelease = async () => {
}

const url = `${MARKET_URL_READ}/${STAGING_SERVER}/_design/builds/_view/releases`;
const releases = await rpn.get({ url: url, qs: getReleasesQuery(), json: true });
const releases = await utils.request({
url: url,
qs: getReleasesQuery(),
noAuth: true,
});

if (!releases.rows.length) {
return MAIN_BRANCH;
}
Expand All @@ -71,7 +76,11 @@ const getMainCHTDockerCompose = async () => {
const release = await getRelease();
for (const composeFile of COMPOSE_FILES) {
const composeFileUrl = `${MARKET_URL_READ}/${STAGING_SERVER}/${release}/docker-compose/${composeFile}.yml`;
const contents = await rpn.get(composeFileUrl);
const contents = await utils.request({
uri: composeFileUrl,
json: false,
noAuth: true,
});
const filePath = path.join(CHT_DOCKER_COMPOSE_FOLDER, `${composeFile}.yml`);
await fs.promises.writeFile(filePath, contents);
}
Expand Down

0 comments on commit e855fd7

Please sign in to comment.