-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(api): Read a product and typecheck SKU string
- Loading branch information
Showing
5 changed files
with
41 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* global $ */ | ||
|
||
await $`tsc -p ../../tsconfig.test.json`; | ||
await $`tsx tests/index.test.ts`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-disable import/no-extraneous-dependencies, no-unused-vars */ | ||
|
||
import fetch, { | ||
Blob, | ||
blobFrom, | ||
blobFromSync, | ||
File, | ||
fileFrom, | ||
fileFromSync, | ||
FormData, | ||
Headers, | ||
Request, | ||
Response, | ||
} from 'node-fetch'; | ||
|
||
if (!globalThis.fetch) { | ||
globalThis.fetch = fetch; | ||
globalThis.Headers = Headers; | ||
globalThis.Request = Request; | ||
globalThis.Response = Response; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable no-console */ | ||
import './fetch-polyfill'; | ||
import callApi from '../src/index'; | ||
|
||
callApi({ | ||
storeId: 1056, | ||
method: 'get', | ||
endpoint: 'products/618041aa239b7206d3fc06de', | ||
}).then(({ data }) => { | ||
if (data.sku === 'string') { | ||
console.log('\\o/'); | ||
} | ||
console.info(`✓ Read product ${data.sku} and checked SKU type string`); | ||
}); |
This file was deleted.
Oops, something went wrong.