File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import CreateActivityHandler from './CreateActivityHandler';
55import SourcePathHandler from './SourcePathHandler' ;
66import UserPathHandler from './UserPathHandler' ;
77import SubjectPathResolver from './SubjectPathResolver' ;
8+ import ComunicaUpdateEngine from './ComunicaUpdateEngine' ;
89
910const { as } = context [ '@context' ] ;
1011
@@ -34,14 +35,20 @@ export default rootPath = new PathFactory({
3435 // Handlers of specific named properties
3536 handlers : {
3637 ...defaultHandlers ,
38+
3739 // The `from` property takes a source URI as input
3840 from : new SourcePathHandler ( subjectPathFactory ) ,
3941 // The `user` property starts a path with the current user as subject
4042 user : new UserPathHandler ( subjectPathFactory ) ,
43+
44+ // Clears the cache for the given document (or everything, if undefined)
45+ clearCache : ( { settings } ) => doc => settings . queryEngine . clearCache ( doc ) ,
4146 } ,
4247 // Handlers of all remaining properties
4348 resolvers : [
4449 // `data[url]` starts a path with the property as subject
4550 new SubjectPathResolver ( subjectPathFactory ) ,
4651 ] ,
52+ // Global query engine (currently only used for clearing the cache)
53+ queryEngine : new ComunicaUpdateEngine ( ) ,
4754} ) . create ( ) ;
Original file line number Diff line number Diff line change @@ -67,6 +67,15 @@ describe('The @solid/ldflex module', () => {
6767 expect ( data . user . root . root . user . root ) . toBe ( data ) ;
6868 } ) ;
6969 } ) ;
70+
71+ describe ( 'the clearCache path' , ( ) => {
72+ it ( 'returns a function to clear the cache' , ( ) => {
73+ const document = { } ;
74+ data . clearCache ( document ) ;
75+ expect ( ComunicaUpdateEngine . prototype . clearCache ) . toHaveBeenCalledTimes ( 1 ) ;
76+ expect ( ComunicaUpdateEngine . prototype . clearCache ) . toHaveBeenCalledWith ( document ) ;
77+ } ) ;
78+ } ) ;
7079} ) ;
7180
7281const urlQuery = `SELECT ?firstName WHERE {
You can’t perform that action at this time.
0 commit comments