Skip to content

Commit 32ec228

Browse files
committed
feat: createUser()
1 parent 4c18efc commit 32ec228

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packages/core/auth-js/test/clientWithSignupsDisabled.test.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ const auth = new GoTrueClient({
99
persistSession: true,
1010
})
1111

12-
const adminSecret =
13-
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnb3RydWUiLCJpYXQiOjE2MzYwMTU5NzAsImV4cCI6MTk4MzE3MTE3MCwiYXVkIjoiYWRtaW4iLCJzdWIiOiIifQ.A8bAscL628GfD_7eluAS3xMo-5zMDG1p70OhdqdTbPM'
12+
const ADMIN_JWT = [
13+
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9',
14+
'eyJpc3MiOiJnb3RydWUiLCJpYXQiOjE2MzYwMTU5NzAsImV4cCI6MTk4MzE3MTE3MCwiYXVkIjoiYWRtaW4iLCJzdWIiOiIifQ',
15+
'A8bAscL628GfD_7eluAS3xMo-5zMDG1p70OhdqdTbPM',
16+
].join('.')
17+
1418
const authAdmin = new GoTrueApi({
1519
url: GOTRUE_URL,
1620
headers: {
17-
Authorization: `Bearer ${adminSecret}`,
21+
Authorization: `Bearer ${ADMIN_JWT}`,
1822
},
1923
})
2024

@@ -36,9 +40,11 @@ test('createUser() should create a new user, even if signups are disabled', asyn
3640
email,
3741
})
3842
expect(error).toBeNull()
39-
expect(data).toBeNull()
43+
expect(data.email).toEqual(email)
4044

4145
const { error: listError, data: users } = await authAdmin.listUsers()
4246
expect(listError).toBeNull()
43-
expect(users).toBeNull()
47+
48+
const user = users.find((u) => u.email === email)
49+
expect(user.email).toEqual(email)
4450
})

0 commit comments

Comments
 (0)