Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LucienHH committed Dec 11, 2023
1 parent 803eca2 commit cef6d33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/TokenManagers/LiveTokenManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class LiveTokenManager {

// if the response is 200 then we have landed on a "failed" page i.e. Incorrect credentials, new application or a new signin location
if (response.status === 200) {
throw Error(`Coudln't sign in at ${preAuthResponse.url} with email ${email} and password. Please see https://github.com/PrismarineJS/prismarine-auth/blob/master/docs/API.md#why-is-password-auth-unreliable-`)
throw Error(`Couldn't sign in at ${preAuthResponse.url} with email ${email} and password. Please see https://github.com/PrismarineJS/prismarine-auth/blob/master/docs/API.md#why-is-password-auth-unreliable-`)
}

const location = response.headers.get('location')
Expand Down
12 changes: 7 additions & 5 deletions test/password.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ const chaiAsPromised = require('chai-as-promised')
chai.use(chaiAsPromised)
const { expect } = chai

const { Authflow } = require('../')
const { Authflow, Titles } = require('../')

describe('password authentication', async () => {
const email = '[email protected]'

describe('password authentication', () => {
it('should fail if not given a valid password', async () => {
const flow = new Authflow('this.is.not@valid.email.lol', './test', { password: 'sdfasdfas', flow: 'msal' })
await expect(flow.getXboxToken()).to.eventually.be.rejectedWith('Invalid credentials')
})
const flow = new Authflow(email, './test', { password: 'sdfasdfas', flow: 'live', authTitle: Titles.MinecraftNintendoSwitch })
await expect(flow.getXboxToken()).to.be.rejectedWith(Error, `Couldn't sign in at https://login.live.com/oauth20_authorize.srf?client_id=00000000441cc96b&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&response_type=token&scope=service%3A%3Auser.auth.xboxlive.com%3A%3AMBI_SSL with email ${email} and password. Please see https://github.com/PrismarineJS/prismarine-auth/blob/master/docs/API.md#why-is-password-auth-unreliable-`)
}).timeout(10000)
})

0 comments on commit cef6d33

Please sign in to comment.