-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.test.ts
More file actions
34 lines (25 loc) · 1 KB
/
Copy pathexample.test.ts
File metadata and controls
34 lines (25 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { describe, it, before } from 'node:test';
import { expect } from 'chai';
import { getTestDriver } from './test-setup'
import { App } from './dsl/App';
import { AuthenticationError, WrongCredentialsError } from './dsl/Errors';
describe('Auth acceptance tests', () => {
let app: App;
before(() => {
app = App.getInstance(getTestDriver());
});
it('should fail login with a wrong email', async () => {
expect(await app.login({ email: 'wrong-email@example.com' })).to.be.instanceof(WrongCredentialsError);
});
it('should fail login with a wrong password', async () => {
expect(await app.login({ password: 'wrongpassword' })).to.be.instanceof(WrongCredentialsError);
});
it('should login user', async () => {
await app.login();
expect(await app.userProfile()).not.to.be.instanceof(Error);
});
it('should require a logged in user to get the user profile', async () => {
await app.logout();
expect(await app.userProfile()).to.be.instanceof(AuthenticationError);
});
});