Skip to content

Commit 575c3da

Browse files
committed
add test
1 parent bb41d04 commit 575c3da

1 file changed

Lines changed: 2 additions & 46 deletions

File tree

test/typeIndexLogic.test.ts

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @jest-environment jsdom
33
*
44
*/
5-
import { Fetcher, parse, Store, sym, UpdateManager } from 'rdflib'
5+
import { Fetcher, Store, sym, UpdateManager } from 'rdflib'
66
import { createAclLogic } from '../src/acl/aclLogic'
77
import { createProfileLogic } from '../src/profile/profileLogic'
88
import { createTypeIndexLogic} from '../src/typeIndex/typeIndexLogic'
@@ -51,7 +51,7 @@ describe('TypeIndex logic NEW', () => {
5151
requests = []
5252
statustoBeReturned = 200
5353

54-
fetchMock.mockIf(/^(https?|mailto):.*$/, async req => {
54+
fetchMock.mockIf(/^https?.*$/, async req => {
5555

5656
if (req.method !== 'GET') {
5757
requests.push(req)
@@ -131,50 +131,6 @@ describe('TypeIndex logic NEW', () => {
131131
expect(store.statementsMatching(null, null, null, AlicePrivateTypeIndex).length).toEqual(8)
132132
expect(store.statementsMatching(null, null, null, AlicePublicTypeIndex).length).toEqual(8)
133133
})
134-
it('uses existing publicTypeIndex when suggestion fails', async () => {
135-
const carol = sym('urn:uuid:carol#me')
136-
const CarolProfileDoc = carol.doc()
137-
const CarolPreferencesFile = sym('https://carol.example.com/settings/prefs.ttl')
138-
const CarolPublicTypeIndex = sym('https://carol.example.com/profile/public-type-index.ttl')
139-
const CarolPrivateTypeIndex = sym('https://carol.example.com/settings/private-type-index.ttl')
140-
141-
const CarolProfile = `
142-
<#me> a vcard:Individual;
143-
space:preferencesFile ${CarolPreferencesFile};
144-
solid:publicTypeIndex ${CarolPublicTypeIndex}.
145-
`
146-
const CarolPreferences = `
147-
${carol} solid:privateTypeIndex ${CarolPrivateTypeIndex} .
148-
`
149-
150-
web[CarolPreferencesFile.uri] = CarolPreferences
151-
web[CarolPublicTypeIndex.uri] = `
152-
:t solid:forClass wf:Tracker; solid:instance <../publicStuff/actionItems.ttl#this> .
153-
`
154-
web[CarolPrivateTypeIndex.uri] = `
155-
:t solid:forClass wf:Tracker; solid:instance <../privateStuff/ToDo.ttl#this> .
156-
`
157-
158-
const util = createUtilityLogic(store, createAclLogic(store), createContainerLogic(store))
159-
const profileLogic = {
160-
loadProfile: async (user) => {
161-
parse(prefixes + CarolProfile, store, CarolProfileDoc.uri, 'text/turtle')
162-
return user.doc()
163-
},
164-
silencedLoadPreferences: async () => {
165-
parse(prefixes + CarolPreferences, store, CarolPreferencesFile.uri, 'text/turtle')
166-
return CarolPreferencesFile
167-
}
168-
}
169-
const typeIndexLogicWithStub = createTypeIndexLogic(store, authn, profileLogic as any, util)
170-
171-
const result = await typeIndexLogicWithStub.loadTypeIndexesFor(carol)
172-
expect(result).toEqual([
173-
{ label: 'public', index: CarolPublicTypeIndex as any, agent: carol as any },
174-
{ label: 'private', index: CarolPrivateTypeIndex as any, agent: carol as any }
175-
])
176-
expect(requests.length).toEqual(0)
177-
})
178134
})
179135

180136
const ClubScopes =

0 commit comments

Comments
 (0)