forked from nodeSolidServer/node-solid-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser-account-test.js
More file actions
40 lines (33 loc) · 1.15 KB
/
user-account-test.js
File metadata and controls
40 lines (33 loc) · 1.15 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
34
35
36
37
38
39
40
'use strict'
/* eslint-disable no-unused-expressions */
const chai = require('chai')
const expect = chai.expect
const UserAccount = require('../../lib/models/user-account')
describe('UserAccount', () => {
describe('from()', () => {
it('initializes the object with passed in options', () => {
const options = {
username: 'alice',
webId: 'https://alice.com/#me',
name: 'Alice',
email: 'alice@alice.com'
}
const account = UserAccount.from(options)
expect(account.username).to.equal(options.username)
expect(account.webId).to.equal(options.webId)
expect(account.name).to.equal(options.name)
expect(account.email).to.equal(options.email)
})
})
describe('id getter', () => {
it('should return null if webId is null', () => {
const account = new UserAccount()
expect(account.id).to.be.null
})
it('should return the WebID uri minus the protocol and slashes', () => {
const webId = 'https://alice.example.com/profile/card#me'
const account = new UserAccount({ webId })
expect(account.id).to.equal('alice.example.com/profile/card#me')
})
})
})