Skip to content

Commit

Permalink
test: use to deep equal
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-elliott committed Jan 2, 2023
1 parent d4115e2 commit e9a1358
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions cypress/integration/oauth2/refresh_token.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe("The OAuth 2.0 Refresh Token Grant", function () {
})
})

it("should narrow Refresh Token scopes correctly", function () {
it("should narrow and broaded Refresh Token scope correctly", function () {
const referrer = `${Cypress.env("client_url")}/empty`
cy.visit(referrer, {
failOnStatusCode: false,
Expand All @@ -109,23 +109,21 @@ describe("The OAuth 2.0 Refresh Token Grant", function () {
}).then((originalResponse) => {
expect(originalResponse.status).to.eq(200)
expect(originalResponse.body.refresh_token).to.not.be.empty
expect(originalResponse.body.scope).to.eq("offline_access openid foo bar baz")
expect(originalResponse.body.scope).to.deep.equal(["offline_access", "openid", "foo", "bar", "baz"])

const originalToken = originalResponse.body.refresh_token

cy.refreshTokenBrowserScope(client, originalToken, "offline_access openid foo").then(
(refreshedResponse) => {
cy.refreshTokenBrowserScope(client, originalToken, "offline_access openid foo").then((refreshedResponse) => {
expect(refreshedResponse.status).to.eq(200)
expect(refreshedResponse.body.refresh_token).to.not.be.empty
expect(refreshedResponse.body.scope).to.eq("offline_access openid foo")
expect(refreshedResponse.body.scope).to.deep.equal(["offline_access", "openid", "foo"])

const refreshedToken = refreshedResponse.body.refresh_token

cy.refreshTokenBrowserScope(client, refreshedToken, "offline_access openid foo bar baz").then(
(finalRefreshedResponse) => {
cy.refreshTokenBrowserScope(client, refreshedToken, "offline_access openid foo bar").then((finalRefreshedResponse) => {
expect(finalRefreshedResponse.status).to.eq(200)
expect(finalRefreshedResponse.body.refresh_token).to.not.be.empty
expect(finalRefreshedResponse.body.scope).to.eq("offline_access openid foo bar baz")
expect(finalRefreshedResponse.body.scope).to.deep.equal(["offline_access", "openid", "foo", "bar"])
},
)
},
Expand Down

0 comments on commit e9a1358

Please sign in to comment.