Skip to content

Commit 2caace0

Browse files
committed
test
1 parent 7c40e61 commit 2caace0

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/util/interpolate.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ describe('interpolate', () => {
125125

126126
const i11nFn = (t: number) => interpolate.projection(Globe, Mercator, t);
127127
expect(i11nFn(0.5)).toBeInstanceOf(ProjectionTransition);
128-
expect(i11nFn(0.5).toString()).toBe('["globe-to-mercator", 0.5]');
128+
expect(i11nFn(0.5).toString()).toBe('["globe", "mercator", 0.5]');
129129
});
130130

131131
describe('interpolate variableAnchorOffsetCollection', () => {

src/util/projection.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const Mercator = new Projection('mercator');
55

66
describe('Projection class', () => {
77
test('should serialize transition to string format', () => {
8-
expect(`${new ProjectionTransition(Mercator, Globe, 0.2)}`).toBe('["mercator-to-globe", 0.2]');
9-
expect(`${new ProjectionTransition(Globe, Mercator, 0.1)}`).toBe('["globe-to-mercator", 0.1]');
8+
expect(`${new ProjectionTransition(Mercator, Globe, 0.2)}`).toBe('["mercator", "globe", 0.2]');
9+
expect(`${new ProjectionTransition(Globe, Mercator, 0.1)}`).toBe('["globe", "mercator", 0.1]');
1010
});
1111

1212
test('should serialize single projection to string format', () => {

src/util/projection.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ export class Projection {
1313

1414
export class ProjectionTransition {
1515

16-
projection: string;
17-
interpolation;
16+
from: Projection;
17+
to: Projection;
18+
interpolation: number;
19+
1820

1921
constructor(from: Projection, to: Projection, interpolation: number) {
20-
21-
this.projection = `${from}-to-${to}`;
22+
this.from = from;
23+
this.to = to;
2224
this.interpolation = interpolation;
23-
2425
}
2526

2627
toString(): string {
27-
return `["${this.projection}", ${this.interpolation}]`;
28+
return `["${this.from}", "${this.to}", ${this.interpolation}]`;
2829
}
2930
}

0 commit comments

Comments
 (0)