solid-logic 3.0.9-f327aa58 → 3.0.9-f51524a8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel.config.js +6 -0
- package/eslint.config.js +23 -24
- package/jest.config.js +15 -8
- package/lib/acl/aclLogic.d.ts +2 -2
- package/lib/acl/aclLogic.d.ts.map +1 -1
- package/lib/authSession/authSession.d.ts.map +1 -1
- package/lib/authn/SolidAuthnLogic.d.ts +3 -3
- package/lib/authn/SolidAuthnLogic.d.ts.map +1 -1
- package/lib/authn/authUtil.d.ts +1 -1
- package/lib/chat/chatLogic.d.ts +1 -1
- package/lib/inbox/inboxLogic.d.ts +1 -1
- package/lib/inbox/inboxLogic.d.ts.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/logic/CustomError.d.ts.map +1 -1
- package/lib/logic/solidLogic.d.ts +2 -2
- package/lib/logic/solidLogic.d.ts.map +1 -1
- package/lib/profile/profileLogic.d.ts +1 -1
- package/lib/solid-logic.js +107 -0
- package/lib/solid-logic.js.map +1 -0
- package/lib/types.d.ts +2 -2
- package/lib/util/containerLogic.d.ts +1 -1
- package/lib/util/containerLogic.d.ts.map +1 -1
- package/lib/util/debug.d.ts.map +1 -1
- package/lib/util/utilityLogic.d.ts +1 -1
- package/lib/util/utilityLogic.d.ts.map +1 -1
- package/lib/util/utils.d.ts +1 -1
- package/lib/util/utils.d.ts.map +1 -1
- package/package.json +39 -16
- package/rollup.config.js +29 -0
- package/src/acl/aclLogic.ts +8 -8
- package/src/authSession/authSession.ts +7 -1
- package/src/authn/SolidAuthnLogic.ts +7 -8
- package/src/authn/authUtil.ts +1 -1
- package/src/chat/chatLogic.ts +75 -75
- package/src/inbox/inboxLogic.ts +19 -19
- package/src/index.ts +1 -1
- package/src/logic/CustomError.ts +6 -6
- package/src/logic/solidLogic.ts +22 -22
- package/src/logic/solidLogicSingleton.ts +3 -3
- package/src/profile/profileLogic.ts +22 -22
- package/src/typeIndex/typeIndexLogic.ts +7 -7
- package/src/types.ts +2 -2
- package/src/util/containerLogic.ts +15 -15
- package/src/util/debug.ts +4 -8
- package/src/util/utilityLogic.ts +18 -18
- package/src/util/utils.ts +12 -12
- package/src/versionInfo.ts +32 -0
- package/test/aclLogic.test.ts +5 -5
- package/test/authUtil.test.ts +1 -1
- package/test/chatLogic.test.ts +160 -154
- package/test/container.test.ts +23 -23
- package/test/helpers/dataSetup.ts +2 -1
- package/test/helpers/setup.ts +8 -3
- package/test/inboxLogic.test.ts +101 -110
- package/test/logic.test.ts +2 -2
- package/test/profileLogic.test.ts +35 -33
- package/test/solidAuthLogic.test.ts +1 -1
- package/test/typeIndexLogic.test.ts +71 -71
- package/test/utilityLogic.test.ts +46 -45
- package/test/utils.test.ts +11 -11
- package/timestamp.sh +13 -0
- package/tsconfig.json +5 -3
- package/tsconfig.test.json +8 -0
- package/lib/acl/aclLogic.js +0 -168
- package/lib/acl/aclLogic.js.map +0 -1
- package/lib/authSession/authSession.js +0 -6
- package/lib/authSession/authSession.js.map +0 -1
- package/lib/authn/SolidAuthnLogic.js +0 -193
- package/lib/authn/SolidAuthnLogic.js.map +0 -1
- package/lib/authn/authUtil.js +0 -105
- package/lib/authn/authUtil.js.map +0 -1
- package/lib/chat/chatLogic.js +0 -272
- package/lib/chat/chatLogic.js.map +0 -1
- package/lib/inbox/inboxLogic.js +0 -139
- package/lib/inbox/inboxLogic.js.map +0 -1
- package/lib/index.js +0 -29
- package/lib/index.js.map +0 -1
- package/lib/issuer/issuerLogic.js +0 -52
- package/lib/issuer/issuerLogic.js.map +0 -1
- package/lib/logic/CustomError.js +0 -89
- package/lib/logic/CustomError.js.map +0 -1
- package/lib/logic/solidLogic.js +0 -102
- package/lib/logic/solidLogic.js.map +0 -1
- package/lib/logic/solidLogicSingleton.js +0 -94
- package/lib/logic/solidLogicSingleton.js.map +0 -1
- package/lib/profile/profileLogic.js +0 -259
- package/lib/profile/profileLogic.js.map +0 -1
- package/lib/typeIndex/typeIndexLogic.js +0 -399
- package/lib/typeIndex/typeIndexLogic.js.map +0 -1
- package/lib/types.js +0 -3
- package/lib/types.js.map +0 -1
- package/lib/util/containerLogic.js +0 -102
- package/lib/util/containerLogic.js.map +0 -1
- package/lib/util/debug.js +0 -40
- package/lib/util/debug.js.map +0 -1
- package/lib/util/ns.js +0 -44
- package/lib/util/ns.js.map +0 -1
- package/lib/util/utilityLogic.js +0 -284
- package/lib/util/utilityLogic.js.map +0 -1
- package/lib/util/utils.js +0 -47
- package/lib/util/utils.js.map +0 -1
package/test/inboxLogic.test.ts
CHANGED
|
@@ -2,104 +2,104 @@
|
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*
|
|
4
4
|
*/
|
|
5
|
-
import { UpdateManager, Store, Fetcher, sym } from
|
|
6
|
-
import { createAclLogic } from
|
|
7
|
-
import { createInboxLogic } from '../src/inbox/inboxLogic'
|
|
8
|
-
import { createProfileLogic } from
|
|
9
|
-
import { createContainerLogic } from
|
|
10
|
-
import { createUtilityLogic } from
|
|
5
|
+
import { UpdateManager, Store, Fetcher, sym } from 'rdflib'
|
|
6
|
+
import { createAclLogic } from '../src/acl/aclLogic'
|
|
7
|
+
import { createInboxLogic } from '../src/inbox/inboxLogic'
|
|
8
|
+
import { createProfileLogic } from '../src/profile/profileLogic'
|
|
9
|
+
import { createContainerLogic } from '../src/util/containerLogic'
|
|
10
|
+
import { createUtilityLogic } from '../src/util/utilityLogic'
|
|
11
11
|
|
|
12
|
-
const alice = sym(
|
|
13
|
-
const bob = sym(
|
|
12
|
+
const alice = sym('https://alice.example.com/profile/card#me')
|
|
13
|
+
const bob = sym('https://bob.example.com/profile/card#me')
|
|
14
14
|
|
|
15
|
-
describe(
|
|
16
|
-
let store
|
|
15
|
+
describe('Inbox logic', () => {
|
|
16
|
+
let store
|
|
17
17
|
let inboxLogic
|
|
18
18
|
beforeEach(() => {
|
|
19
|
-
fetchMock.resetMocks()
|
|
20
|
-
fetchMock.mockResponse(
|
|
19
|
+
fetchMock.resetMocks()
|
|
20
|
+
fetchMock.mockResponse('Not Found', {
|
|
21
21
|
status: 404,
|
|
22
|
-
})
|
|
22
|
+
})
|
|
23
23
|
store = new Store()
|
|
24
|
-
store.fetcher = new Fetcher(store, { fetch: fetch })
|
|
25
|
-
store.updater = new UpdateManager(store)
|
|
24
|
+
store.fetcher = new Fetcher(store, { fetch: fetch })
|
|
25
|
+
store.updater = new UpdateManager(store)
|
|
26
26
|
const authn = {
|
|
27
27
|
currentUser: () => {
|
|
28
|
-
return alice
|
|
28
|
+
return alice
|
|
29
29
|
},
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
const containerLogic = createContainerLogic(store)
|
|
32
32
|
const aclLogic = createAclLogic(store)
|
|
33
|
-
const util = createUtilityLogic(store, aclLogic, containerLogic)
|
|
34
|
-
const profile = createProfileLogic(store, authn, util)
|
|
35
|
-
inboxLogic = createInboxLogic(store, profile, util, containerLogic, aclLogic)
|
|
36
|
-
})
|
|
33
|
+
const util = createUtilityLogic(store, aclLogic, containerLogic)
|
|
34
|
+
const profile = createProfileLogic(store, authn, util)
|
|
35
|
+
inboxLogic = createInboxLogic(store, profile, util, containerLogic, aclLogic)
|
|
36
|
+
})
|
|
37
37
|
|
|
38
|
-
describe(
|
|
39
|
-
describe(
|
|
40
|
-
let result
|
|
38
|
+
describe('getNewMessages', () => {
|
|
39
|
+
describe('When inbox is empty', () => {
|
|
40
|
+
let result
|
|
41
41
|
beforeEach(async () => {
|
|
42
|
-
bobHasAnInbox()
|
|
43
|
-
inboxIsEmpty()
|
|
44
|
-
result = await inboxLogic.getNewMessages(bob)
|
|
45
|
-
})
|
|
46
|
-
it(
|
|
47
|
-
expect(result).toEqual([])
|
|
48
|
-
})
|
|
49
|
-
})
|
|
50
|
-
describe(
|
|
51
|
-
let result
|
|
42
|
+
bobHasAnInbox()
|
|
43
|
+
inboxIsEmpty()
|
|
44
|
+
result = await inboxLogic.getNewMessages(bob)
|
|
45
|
+
})
|
|
46
|
+
it('Resolves to an empty array', () => {
|
|
47
|
+
expect(result).toEqual([])
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
describe('When container has some containment triples', () => {
|
|
51
|
+
let result
|
|
52
52
|
beforeEach(async () => {
|
|
53
|
-
bobHasAnInbox()
|
|
54
|
-
inboxHasSomeContainmentTriples()
|
|
55
|
-
const messages = await inboxLogic.getNewMessages(bob)
|
|
53
|
+
bobHasAnInbox()
|
|
54
|
+
inboxHasSomeContainmentTriples()
|
|
55
|
+
const messages = await inboxLogic.getNewMessages(bob)
|
|
56
56
|
result = messages.map(oneMessage => oneMessage.value)
|
|
57
|
-
})
|
|
58
|
-
it(
|
|
57
|
+
})
|
|
58
|
+
it('Resolves to an array with URLs of non-container resources in inbox', () => {
|
|
59
59
|
expect(result.sort()).toEqual([
|
|
60
60
|
'https://container.com/foo.txt'
|
|
61
|
-
].sort())
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
})
|
|
61
|
+
].sort())
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
65
|
describe('createInboxFor', () => {
|
|
66
66
|
beforeEach(async () => {
|
|
67
|
-
aliceHasValidProfile()
|
|
67
|
+
aliceHasValidProfile()
|
|
68
68
|
// First for the PUT:
|
|
69
69
|
fetchMock.mockOnceIf(
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
'https://alice.example.com/p2p-inboxes/Peer%20Person/',
|
|
71
|
+
'Created', {
|
|
72
72
|
status: 201
|
|
73
73
|
}
|
|
74
74
|
)
|
|
75
75
|
// Then for the GET to read the ACL link:
|
|
76
76
|
fetchMock.mockOnceIf(
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
'https://alice.example.com/p2p-inboxes/Peer%20Person/',
|
|
78
|
+
' ', {
|
|
79
79
|
status: 200,
|
|
80
80
|
headers: {
|
|
81
81
|
Link: '<https://some/acl>; rel="acl"',
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
)
|
|
85
|
-
fetchMock.mockIf(
|
|
85
|
+
fetchMock.mockIf('https://some/acl', 'Created', { status: 201 })
|
|
86
86
|
|
|
87
|
-
await inboxLogic.createInboxFor('https://peer.com/#me', 'Peer Person')
|
|
88
|
-
})
|
|
89
|
-
it(
|
|
87
|
+
await inboxLogic.createInboxFor('https://peer.com/#me', 'Peer Person')
|
|
88
|
+
})
|
|
89
|
+
it('creates the inbox', () => {
|
|
90
90
|
expect(fetchMock.mock.calls).toEqual([
|
|
91
|
-
[
|
|
92
|
-
[
|
|
93
|
-
body:
|
|
91
|
+
[ 'https://alice.example.com/profile/card', fetchMock.mock.calls[0][1] ],
|
|
92
|
+
[ 'https://alice.example.com/p2p-inboxes/Peer%20Person/', {
|
|
93
|
+
body: ' ',
|
|
94
94
|
headers: {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
Link:
|
|
95
|
+
'Content-Type': 'text/turtle',
|
|
96
|
+
'If-None-Match': '*',
|
|
97
|
+
Link: '<http://www.w3.org/ns/ldp#BasicContainer>; rel="type"',
|
|
98
98
|
},
|
|
99
|
-
method:
|
|
99
|
+
method: 'PUT'
|
|
100
100
|
}],
|
|
101
|
-
[
|
|
102
|
-
[
|
|
101
|
+
[ 'https://alice.example.com/p2p-inboxes/Peer%20Person/', fetchMock.mock.calls[2][1] ],
|
|
102
|
+
[ 'https://some/acl', {
|
|
103
103
|
body: '@prefix acl: <http://www.w3.org/ns/auth/acl#>.\n' +
|
|
104
104
|
'\n' +
|
|
105
105
|
'<#alice> a acl:Authorization;\n' +
|
|
@@ -116,53 +116,53 @@ describe("Inbox logic", () => {
|
|
|
116
116
|
],
|
|
117
117
|
method: 'PUT'
|
|
118
118
|
}]
|
|
119
|
-
])
|
|
120
|
-
})
|
|
119
|
+
])
|
|
120
|
+
})
|
|
121
121
|
|
|
122
|
-
})
|
|
122
|
+
})
|
|
123
123
|
describe('markAsRead', () => {
|
|
124
124
|
beforeEach(async () => {
|
|
125
125
|
fetchMock.mockOnceIf(
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
'https://container.com/item.ttl',
|
|
127
|
+
'<#some> <#inbox> <#item> .',
|
|
128
128
|
{
|
|
129
|
-
headers: {
|
|
129
|
+
headers: { 'Content-Type': 'text/turtle' },
|
|
130
130
|
}
|
|
131
|
-
)
|
|
131
|
+
)
|
|
132
132
|
fetchMock.mockOnceIf(
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
'https://container.com/archive/2111/03/31/item.ttl',
|
|
134
|
+
'Created',
|
|
135
135
|
{
|
|
136
136
|
status: 201,
|
|
137
|
-
headers: {
|
|
137
|
+
headers: { 'Content-Type': 'text/turtle' },
|
|
138
138
|
}
|
|
139
|
-
)
|
|
140
|
-
await inboxLogic.markAsRead(
|
|
141
|
-
})
|
|
139
|
+
)
|
|
140
|
+
await inboxLogic.markAsRead('https://container.com/item.ttl', new Date('31 March 2111 UTC'))
|
|
141
|
+
})
|
|
142
142
|
it('moves the item to archive', async () => {
|
|
143
143
|
expect(fetchMock.mock.calls).toEqual([
|
|
144
|
-
[
|
|
144
|
+
[ 'https://container.com/item.ttl' ],
|
|
145
145
|
[
|
|
146
|
-
|
|
146
|
+
'https://container.com/archive/2111/03/31/item.ttl',
|
|
147
147
|
{
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
'body': '<#some> <#inbox> <#item> .',
|
|
149
|
+
'headers': [
|
|
150
150
|
[
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
'Content-Type',
|
|
152
|
+
'text/turtle',
|
|
153
153
|
],
|
|
154
154
|
],
|
|
155
|
-
|
|
155
|
+
'method': 'PUT',
|
|
156
156
|
},
|
|
157
157
|
],
|
|
158
|
-
[
|
|
159
|
-
])
|
|
160
|
-
})
|
|
161
|
-
})
|
|
158
|
+
[ 'https://container.com/item.ttl', { method: 'DELETE' } ],
|
|
159
|
+
])
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
162
|
|
|
163
163
|
function aliceHasValidProfile() {
|
|
164
164
|
fetchMock.mockOnceIf(
|
|
165
|
-
|
|
165
|
+
'https://alice.example.com/profile/card',
|
|
166
166
|
`
|
|
167
167
|
<https://alice.example.com/profile/card#me>
|
|
168
168
|
<http://www.w3.org/ns/pim/space#storage> <https://alice.example.com/> ;
|
|
@@ -170,49 +170,40 @@ describe("Inbox logic", () => {
|
|
|
170
170
|
.`,
|
|
171
171
|
{
|
|
172
172
|
headers: {
|
|
173
|
-
|
|
173
|
+
'Content-Type': 'text/turtle',
|
|
174
174
|
},
|
|
175
175
|
}
|
|
176
|
-
)
|
|
176
|
+
)
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
function bobHasAnInbox() {
|
|
180
180
|
fetchMock.mockOnceIf(
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
'https://bob.example.com/profile/card',
|
|
182
|
+
'<https://bob.example.com/profile/card#me><http://www.w3.org/ns/ldp#inbox><https://container.com/>.',
|
|
183
183
|
{
|
|
184
|
-
headers: {
|
|
184
|
+
headers: { 'Content-Type': 'text/turtle' },
|
|
185
185
|
}
|
|
186
|
-
)
|
|
186
|
+
)
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
function inboxIsEmpty() {
|
|
190
190
|
fetchMock.mockOnceIf(
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
'https://container.com/',
|
|
192
|
+
' ', // FIXME: https://github.com/jefflau/jest-fetch-mock/issues/189
|
|
193
193
|
{
|
|
194
|
-
headers: {
|
|
194
|
+
headers: { 'Content-Type': 'text/turtle' },
|
|
195
195
|
}
|
|
196
|
-
)
|
|
196
|
+
)
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
function inboxHasSomeContainmentTriples() {
|
|
200
200
|
fetchMock.mockOnceIf(
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
'https://container.com/',
|
|
202
|
+
'<.> <http://www.w3.org/ns/ldp#contains> <./foo.txt>, <./bar/> .',
|
|
203
203
|
{
|
|
204
|
-
headers: {
|
|
204
|
+
headers: { 'Content-Type': 'text/turtle' },
|
|
205
205
|
}
|
|
206
|
-
)
|
|
206
|
+
)
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
|
|
210
|
-
fetchMock.mockOnceIf(
|
|
211
|
-
"https://container.com/item.ttl",
|
|
212
|
-
"<#some> <#inbox> <#item> .",
|
|
213
|
-
{
|
|
214
|
-
headers: { "Content-Type": "text/turtle" },
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
|
-
}
|
|
218
|
-
});
|
|
209
|
+
})
|
package/test/logic.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { solidLogicSingleton } from
|
|
2
|
-
import { silenceDebugMessages } from
|
|
1
|
+
import { solidLogicSingleton } from '../src/logic/solidLogicSingleton'
|
|
2
|
+
import { silenceDebugMessages } from './helpers/setup'
|
|
3
3
|
|
|
4
4
|
silenceDebugMessages()
|
|
5
5
|
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
* @jest-environment jsdom
|
|
3
3
|
*
|
|
4
4
|
*/
|
|
5
|
-
import { UpdateManager, Store, Fetcher } from 'rdflib'
|
|
6
|
-
import { createProfileLogic } from
|
|
7
|
-
import { createUtilityLogic } from
|
|
8
|
-
import { ns } from
|
|
5
|
+
import { UpdateManager, Store, Fetcher } from 'rdflib'
|
|
6
|
+
import { createProfileLogic } from '../src/profile/profileLogic'
|
|
7
|
+
import { createUtilityLogic } from '../src/util/utilityLogic'
|
|
8
|
+
import { ns } from '../src/util/ns'
|
|
9
9
|
import {
|
|
10
10
|
alice, AlicePreferencesFile, AlicePrivateTypeIndex, AliceProfileFile, bob, boby, loadWebObject
|
|
11
|
-
} from './helpers/dataSetup'
|
|
12
|
-
import { createAclLogic } from
|
|
13
|
-
import { createContainerLogic } from
|
|
11
|
+
} from './helpers/dataSetup'
|
|
12
|
+
import { createAclLogic } from '../src/acl/aclLogic'
|
|
13
|
+
import { createContainerLogic } from '../src/util/containerLogic'
|
|
14
14
|
|
|
15
15
|
const prefixes = Object.keys(ns).map(prefix => `@prefix ${prefix}: ${ns[prefix]('')}.\n`).join('') // In turtle
|
|
16
16
|
const user = alice
|
|
17
17
|
const profile = user.doc()
|
|
18
|
-
let requests = []
|
|
18
|
+
let requests: Request[] = []
|
|
19
19
|
let profileLogic
|
|
20
20
|
|
|
21
|
-
describe(
|
|
21
|
+
describe('Profile', () => {
|
|
22
22
|
|
|
23
23
|
describe('loadProfile', () => {
|
|
24
24
|
window.$SolidTestEnvironment = { username: alice.uri }
|
|
@@ -28,11 +28,11 @@ describe("Profile", () => {
|
|
|
28
28
|
let web = {}
|
|
29
29
|
const authn = {
|
|
30
30
|
currentUser: () => {
|
|
31
|
-
return alice
|
|
31
|
+
return alice
|
|
32
32
|
},
|
|
33
|
-
}
|
|
33
|
+
}
|
|
34
34
|
beforeEach(() => {
|
|
35
|
-
fetchMock.resetMocks()
|
|
35
|
+
fetchMock.resetMocks()
|
|
36
36
|
web = loadWebObject()
|
|
37
37
|
requests = []
|
|
38
38
|
fetchMock.mockIf(/^https?.*$/, async req => {
|
|
@@ -52,9 +52,9 @@ describe("Profile", () => {
|
|
|
52
52
|
body: prefixes + contents, // Add namespaces to anything
|
|
53
53
|
status: 200,
|
|
54
54
|
headers: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
'Content-Type': 'text/turtle',
|
|
56
|
+
'WAC-Allow': 'user="write", public="read"',
|
|
57
|
+
'Accept-Patch': 'application/sparql-update'
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
} // if contents
|
|
@@ -65,8 +65,8 @@ describe("Profile", () => {
|
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
store = new Store()
|
|
68
|
-
store.fetcher = new Fetcher(store, { fetch: fetch })
|
|
69
|
-
store.updater = new UpdateManager(store)
|
|
68
|
+
store.fetcher = new Fetcher(store, { fetch: fetch })
|
|
69
|
+
store.updater = new UpdateManager(store)
|
|
70
70
|
const util = createUtilityLogic(store, createAclLogic(store), createContainerLogic(store))
|
|
71
71
|
profileLogic = createProfileLogic(store, authn, util)
|
|
72
72
|
})
|
|
@@ -91,11 +91,11 @@ describe("Profile", () => {
|
|
|
91
91
|
let web = {}
|
|
92
92
|
const authn = {
|
|
93
93
|
currentUser: () => {
|
|
94
|
-
return alice
|
|
94
|
+
return alice
|
|
95
95
|
},
|
|
96
|
-
}
|
|
96
|
+
}
|
|
97
97
|
beforeEach(() => {
|
|
98
|
-
fetchMock.resetMocks()
|
|
98
|
+
fetchMock.resetMocks()
|
|
99
99
|
web = loadWebObject()
|
|
100
100
|
requests = []
|
|
101
101
|
fetchMock.mockIf(/^https?.*$/, async req => {
|
|
@@ -115,9 +115,9 @@ describe("Profile", () => {
|
|
|
115
115
|
body: prefixes + contents, // Add namespaces to anything
|
|
116
116
|
status: 200,
|
|
117
117
|
headers: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
'Content-Type': 'text/turtle',
|
|
119
|
+
'WAC-Allow': 'user="write", public="read"',
|
|
120
|
+
'Accept-Patch': 'application/sparql-update'
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
} // if contents
|
|
@@ -128,8 +128,8 @@ describe("Profile", () => {
|
|
|
128
128
|
})
|
|
129
129
|
|
|
130
130
|
store = new Store()
|
|
131
|
-
store.fetcher = new Fetcher(store, { fetch: fetch })
|
|
132
|
-
store.updater = new UpdateManager(store)
|
|
131
|
+
store.fetcher = new Fetcher(store, { fetch: fetch })
|
|
132
|
+
store.updater = new UpdateManager(store)
|
|
133
133
|
const util = createUtilityLogic(store, createAclLogic(store), createContainerLogic(store))
|
|
134
134
|
profileLogic = createProfileLogic(store, authn, util)
|
|
135
135
|
})
|
|
@@ -147,6 +147,7 @@ describe("Profile", () => {
|
|
|
147
147
|
expect(store.holds(user, ns.solid('privateTypeIndex'), AlicePrivateTypeIndex, AlicePreferencesFile)).toEqual(true)
|
|
148
148
|
})
|
|
149
149
|
it('creates new file', async () => {
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
150
151
|
const result = await profileLogic.silencedLoadPreferences(bob)
|
|
151
152
|
|
|
152
153
|
const patchRequest = requests[0]
|
|
@@ -172,11 +173,11 @@ describe("Profile", () => {
|
|
|
172
173
|
let web = {}
|
|
173
174
|
const authn = {
|
|
174
175
|
currentUser: () => {
|
|
175
|
-
return boby
|
|
176
|
+
return boby
|
|
176
177
|
},
|
|
177
|
-
}
|
|
178
|
+
}
|
|
178
179
|
beforeEach(() => {
|
|
179
|
-
fetchMock.resetMocks()
|
|
180
|
+
fetchMock.resetMocks()
|
|
180
181
|
web = loadWebObject()
|
|
181
182
|
requests = []
|
|
182
183
|
fetchMock.mockIf(/^https?.*$/, async req => {
|
|
@@ -196,9 +197,9 @@ describe("Profile", () => {
|
|
|
196
197
|
body: prefixes + contents, // Add namespaces to anything
|
|
197
198
|
status: 200,
|
|
198
199
|
headers: {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
'Content-Type': 'text/turtle',
|
|
201
|
+
'WAC-Allow': 'user="write", public="read"',
|
|
202
|
+
'Accept-Patch': 'application/sparql-update'
|
|
202
203
|
}
|
|
203
204
|
}
|
|
204
205
|
} // if contents
|
|
@@ -209,8 +210,8 @@ describe("Profile", () => {
|
|
|
209
210
|
})
|
|
210
211
|
|
|
211
212
|
store = new Store()
|
|
212
|
-
store.fetcher = new Fetcher(store, { fetch: fetch })
|
|
213
|
-
store.updater = new UpdateManager(store)
|
|
213
|
+
store.fetcher = new Fetcher(store, { fetch: fetch })
|
|
214
|
+
store.updater = new UpdateManager(store)
|
|
214
215
|
const util = createUtilityLogic(store, createAclLogic(store), createContainerLogic(store))
|
|
215
216
|
profileLogic = createProfileLogic(store, authn, util)
|
|
216
217
|
})
|
|
@@ -228,6 +229,7 @@ describe("Profile", () => {
|
|
|
228
229
|
expect(store.holds(user, ns.solid('privateTypeIndex'), AlicePrivateTypeIndex, AlicePreferencesFile)).toEqual(true)
|
|
229
230
|
})
|
|
230
231
|
it('creates new file', async () => {
|
|
232
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
231
233
|
const result = await profileLogic.loadPreferences(boby)
|
|
232
234
|
|
|
233
235
|
const patchRequest = requests[0]
|
|
@@ -10,7 +10,7 @@ import { AuthenticationContext } from '../src/types'
|
|
|
10
10
|
silenceDebugMessages()
|
|
11
11
|
let solidAuthnLogic
|
|
12
12
|
|
|
13
|
-
describe(
|
|
13
|
+
describe('SolidAuthnLogic', () => {
|
|
14
14
|
|
|
15
15
|
beforeEach(() => {
|
|
16
16
|
solidAuthnLogic = new SolidAuthnLogic(authSession)
|