Skip to content

Commit

Permalink
refactor: Pull out method name
Browse files Browse the repository at this point in the history
Ensures that the tests fail if the method is renamed, and that the test
suite name stays in sync with the code under test.
  • Loading branch information
l0b0 committed Dec 21, 2023
1 parent 7767050 commit 4ed0470
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/commands/get-odr-base-url/__test__/get-odr-base-url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,25 @@ import { describe, it } from 'node:test';

import { CollectionProps, crses, imageryProducts, regions } from '../get-odr-base-url.js';

describe('getOdrBaseUrl', () => {
const methodName = 'getOdrBaseUrl';

describe(methodName, () => {
it('should throw if the bucket is unknown', () => {
assert.throws(() => {
anyCollectionProps().getOdrBaseUrl(new URL('s3://example-bucket/'));
anyCollectionProps()[methodName](new URL('s3://example-bucket/'));
}, Error('bucket not in bucket list: example-bucket'));
});
it('should return base URL for imagery surveys', () => {
const collectionProps = new CollectionProps('canterbury', 'timaru', 2022, 2023, '0.01m', 'rgb', 2193);
assert.equal(
collectionProps.getOdrBaseUrl(new URL('s3://nz-imagery/')),
collectionProps[methodName](new URL('s3://nz-imagery/')),
's3://nz-imagery/canterbury/timaru_2022-2023_0.01m/rgb/2193/',
);
});
it('should return base URL for digital elevation models', () => {
const collectionProps = new CollectionProps('canterbury', 'kaikoura', 2012, 2012, '10m', 'dem', 2193);
assert.equal(
collectionProps.getOdrBaseUrl(new URL('s3://linz-elevation/')),
collectionProps[methodName](new URL('s3://linz-elevation/')),
's3://linz-elevation/canterbury/kaikoura_2012/dem_10m/2193/',
);
});
Expand Down

0 comments on commit 4ed0470

Please sign in to comment.