Skip to content

Commit dfb94ce

Browse files
committed
Update failing tests
1 parent d509fb0 commit dfb94ce

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

packages/cli-kit/src/private/node/session/exchange.test.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,21 @@ describe('exchange identity token for application tokens', () => {
5555

5656
test('returns tokens for all APIs if a store is passed', async () => {
5757
// Given
58-
const response = new Response(JSON.stringify(data))
59-
60-
// Need to do it 3 times because a Response can only be used once
61-
vi.mocked(shopifyFetch)
62-
.mockResolvedValue(response)
63-
.mockResolvedValueOnce(response.clone())
64-
.mockResolvedValueOnce(response.clone())
65-
.mockResolvedValueOnce(response.clone())
58+
vi.mocked(shopifyFetch).mockImplementation(async () => Promise.resolve(new Response(JSON.stringify(data))))
6659

6760
// When
6861
const got = await exchangeAccessForApplicationTokens(identityToken, scopes, 'storeFQDN')
6962

7063
// Then
7164
const expected = {
65+
'app-management': {
66+
accessToken: "access_token",
67+
expiresAt: expiredDate,
68+
scopes: [
69+
"scope",
70+
"scope2",
71+
],
72+
},
7273
partners: {
7374
accessToken: 'access_token',
7475
expiresAt: expiredDate,
@@ -109,6 +110,14 @@ describe('exchange identity token for application tokens', () => {
109110

110111
// Then
111112
const expected = {
113+
'app-management': {
114+
accessToken: "access_token",
115+
expiresAt: expiredDate,
116+
scopes: [
117+
"scope",
118+
"scope2",
119+
],
120+
},
112121
partners: {
113122
accessToken: 'access_token',
114123
expiresAt: expiredDate,

packages/cli-kit/src/private/node/session/scopes.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ describe('allDefaultScopes', () => {
1919
'https://api.shopify.com/auth/shop.storefront-renderer.devtools',
2020
'https://api.shopify.com/auth/partners.app.cli.access',
2121
'https://api.shopify.com/auth/destinations.readonly',
22+
'https://api.shopify.com/auth/organization.store-management',
23+
'https://api.shopify.com/auth/organization.apps.manage',
2224
...customScopes,
2325
])
2426
})

0 commit comments

Comments
 (0)