Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kennsippell committed Feb 20, 2024
1 parent 933c4d2 commit 672ed44
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions scripts/create-user-managers/create-user-managers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ function parseCommandlineArguments(argv: string[]): CommandLineArgs {
.parse(argv);

const cmdArgs = program.opts();
if (cmdArgs.passwords?.length > 0 && cmdArgs.names.length != cmdArgs.passwords.length) {
throw Error(`Provided ${cmdArgs.names.length} users but ${cmdArgs.passwords.length} passwords. There should be an equal amount if passwords are specified.`);
if (cmdArgs.passwords?.length > 0 && cmdArgs.names.length !== cmdArgs.passwords.length) {
throw Error(`Provided ${cmdArgs.names.length} users but ${cmdArgs.passwords.length} passwords. There should be an equal count.`);
}

return cmdArgs as CommandLineArgs;
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-user-managers/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import createUserManagers from "./create-user-managers";
import createUserManagers from './create-user-managers';

(async () => createUserManagers(process.argv))();
11 changes: 7 additions & 4 deletions test/create-user-managers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ Chai.use(chaiAsPromised);

const { expect } = Chai;

const StandardArgv = ['npx', 'ts-node', 'scripts/create-user-managers/index.ts', '--hostname', 'localhost:5988', '--adminUsername', 'medic', '--adminPassword', 'password'];
const StandardArgv = [
'npx', 'ts-node', 'scripts/create-user-managers/index.ts',
'--hostname', 'localhost:5988', '--adminUsername', 'medic', '--adminPassword', 'password'
];

let fakeGetPlacesWithType;
describe('scripts/create-user-managers.ts', () => {
Expand Down Expand Up @@ -60,7 +63,7 @@ describe('scripts/create-user-managers.ts', () => {
'--names', 'Stan Lee', 'Frank Sinatra',
'--passwords', 'S3cret_abc',
];
await expect(createUserManagers.default(argv)).to.eventually.be.rejectedWith('2 users but 1 passwords')
await expect(createUserManagers.default(argv)).to.eventually.be.rejectedWith('2 users but 1 passwords');
});

it('throw on multiple counties ', async () => {
Expand All @@ -84,7 +87,7 @@ describe('scripts/create-user-managers.ts', () => {
}
]);

await expect(createUserManagers.default(argv)).to.eventually.be.rejectedWith('multiple counties')
await expect(createUserManagers.default(argv)).to.eventually.be.rejectedWith('multiple counties');
});

it('--county flag resolves ambiguous county', async () => {
Expand Down Expand Up @@ -112,4 +115,4 @@ describe('scripts/create-user-managers.ts', () => {
const actual = await createUserManagers.default(argv);
expect(actual.length).to.eq(1);
});
});
});

0 comments on commit 672ed44

Please sign in to comment.