Merge pull request #13864 from Budibase/feature/current-user-global-id-binding

Adding test for globalId in self call
This commit is contained in:
Michael Drury 2024-06-06 13:10:07 +01:00 committed by GitHub
commit 748555b71b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 1 deletions

View File

@ -1,5 +1,8 @@
const setup = require("./utilities")
const { generateUserMetadataID } = require("../../../db/utils")
const {
generateUserMetadataID,
getGlobalIDFromUserMetadataID,
} = require("../../../db/utils")
describe("/authenticate", () => {
let request = setup.getRequest()
@ -20,5 +23,16 @@ describe("/authenticate", () => {
.expect(200)
expect(res.body._id).toEqual(generateUserMetadataID(config.user._id))
})
it("should container the global user ID", async () => {
const res = await request
.get(`/api/self`)
.set(config.defaultHeaders())
.expect("Content-Type", /json/)
.expect(200)
expect(res.body.globalId).toEqual(
getGlobalIDFromUserMetadataID(config.user._id)
)
})
})
})