Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
fix: change type and update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed Jun 5, 2020
1 parent 76530f1 commit dbe4ac1
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 62 deletions.
8 changes: 4 additions & 4 deletions src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ interface ResourceInfo<TResource extends Resource> {

export interface RequestMeta {
requestId: string
timestamp: string
timestamp: Date
quotaMax: number
quotaRemaining: number
quotaResetOn: string
quotaResetOn: Date
}

interface RequestResponse {
Expand Down Expand Up @@ -188,10 +188,10 @@ const parseResponse = <T>(response: RequestResponse): [T, RequestMeta] => {
responseData,
{
requestId: response.headers['x-mws-request-id'],
timestamp: response.headers['x-mws-timestamp'],
timestamp: new Date(response.headers['x-mws-timestamp']),
quotaMax: Number(response.headers['x-mws-quota-max']),
quotaRemaining: Number(response.headers['x-mws-quota-remaining']),
quotaResetOn: response.headers['x-mws-quota-resetson'],
quotaResetOn: new Date(response.headers['x-mws-quota-resetson']),
},
]
}
Expand Down
12 changes: 6 additions & 6 deletions test/unit/__snapshots__/fulfillment-inventory.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -71,9 +71,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -114,9 +114,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
24 changes: 12 additions & 12 deletions test/unit/__snapshots__/orders.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand All @@ -65,9 +65,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -134,9 +134,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -203,9 +203,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -439,9 +439,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand All @@ -460,9 +460,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
68 changes: 34 additions & 34 deletions test/unit/__snapshots__/products.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -146,9 +146,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -262,9 +262,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -383,9 +383,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -478,9 +478,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -574,9 +574,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -605,9 +605,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -636,9 +636,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -778,9 +778,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -893,9 +893,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -991,9 +991,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -1042,9 +1042,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -1098,9 +1098,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -1141,9 +1141,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -1197,9 +1197,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand All @@ -1213,9 +1213,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -1320,9 +1320,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
12 changes: 6 additions & 6 deletions test/unit/__snapshots__/sellers.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-05-06T10:22:23.582Z",
"quotaResetOn": 2020-05-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T08:22:23.582Z",
"timestamp": 2020-05-06T08:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -54,9 +54,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-04-06T10:22:23.582Z",
"quotaResetOn": 2020-04-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T09:22:23.582Z",
"timestamp": 2020-05-06T09:22:23.582Z,
},
]
`;
Expand Down Expand Up @@ -99,9 +99,9 @@ Array [
Object {
"quotaMax": 1000,
"quotaRemaining": 999,
"quotaResetOn": "2020-05-06T10:22:23.582Z",
"quotaResetOn": 2020-05-06T10:22:23.582Z,
"requestId": "0",
"timestamp": "2020-05-06T08:22:23.582Z",
"timestamp": 2020-05-06T08:22:23.582Z,
},
]
`;

0 comments on commit dbe4ac1

Please sign in to comment.