Last active
February 17, 2023 10:54
-
-
Save rjpkuyper/cc6a92e511401faf666848d53a336371 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import { createUrl, getProducts, Paths } from './get-env-vars' | |
describe("GetProducts", () => { | |
const products = [{ id: 1 }]; | |
const httpGet = jest.fn().mockResolvedValue({ | |
json: jest.fn().mockResolvedValue(products) | |
}); | |
test('should create a new url', () => { | |
const url = 'https://example.com' | |
expect(createUrl(Paths.PRODUCTS, url)).toEqual(`${url}/${Paths.PRODUCTS}`); | |
}); | |
test('should get products', async () => { | |
expect(await getProducts(httpGet, 'https://example.com')).toEqual(products) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment