Skip to content

Commit

Permalink
Do not transform to a Date object in the plugin (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
asein-sinch authored Mar 18, 2024
1 parent 5e06b79 commit a3a37be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ implements ResponsePlugin<V | Record<string, any>> {
timestampValue = timestampValue + 'Z';
}
}
res[key] = new Date(timestampValue);
res[key] = timestampValue;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Timezone response plugin', () => {
const runner = plugin.load(context);
const result = await runner.transform(apiResponse);

expect(result.timestamp).toStrictEqual(new Date(TIMESTAMP_WITH_TIMEZONE));
expect(result.timestamp).toBe(TIMESTAMP_WITH_TIMEZONE);
});

it('should NOT update the timestamp if the timezone is already there with "Z" format', async () => {
Expand All @@ -41,7 +41,7 @@ describe('Timezone response plugin', () => {
const runner = plugin.load(context);
const result = await runner.transform(apiResponse);

expect(result.timestamp).toStrictEqual(new Date(TIMESTAMP_WITH_TIMEZONE));
expect(result.timestamp).toBe(TIMESTAMP_WITH_TIMEZONE);
});

it('should update the timestamp if the timezone is already there but with "+XX format"', async () => {
Expand All @@ -52,7 +52,7 @@ describe('Timezone response plugin', () => {
const runner = plugin.load(context);
const result = await runner.transform(apiResponse);

expect(result.timestamp).toStrictEqual(new Date(TIMESTAMP_WITH_TIMEZONE_HOURS_MINUTES));
expect(result.timestamp).toBe(TIMESTAMP_WITH_TIMEZONE_HOURS_MINUTES);
});

it('should NOT update the timestamp if the timezone is already there with "+XX:XX format"', async () => {
Expand All @@ -63,7 +63,7 @@ describe('Timezone response plugin', () => {
const runner = plugin.load(context);
const result = await runner.transform(apiResponse);

expect(result.timestamp).toStrictEqual(new Date(TIMESTAMP_WITH_TIMEZONE_HOURS_MINUTES));
expect(result.timestamp).toBe(TIMESTAMP_WITH_TIMEZONE_HOURS_MINUTES);
});

it('should NOT update the timestamp if the operationId if not listed', async () => {
Expand Down

0 comments on commit a3a37be

Please sign in to comment.