@@ -50,6 +50,8 @@ const prefixes = `@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
5050
5151@prefix : <#>.
5252`
53+ const expectedDefaults = [ 'en' , 'fr' , 'de' , 'it' , 'ar' ]
54+
5355const alice = store . sym ( 'https://alice.example.com/profile#me' )
5456const aliceProfileText = prefixes + `
5557 <#me> a foaf:Person; schema:knowsLanguage ( [ solid:publicId lang:el ] ) . # Just greek `
@@ -61,24 +63,37 @@ const bobProfileText = prefixes + `
6163`
6264parse ( bobProfileText , store , bob . doc ( ) . uri )
6365
64- /*
66+ const charlie = store . sym ( 'https://charlie.example.com/profile#me' )
6567const charlieProfileText = prefixes + `
66- <#me> a foaf:Person . # Nothing stated about languages
67- `
68- */
68+ <#me> a foaf:Person . # Nothing stated about languages`
69+ parse ( charlieProfileText , store , charlie . doc ( ) . uri )
70+
6971const kb = store
7072
73+ describe ( 'defaultPreferedLangages' , ( ) => {
74+ it ( 'exists as a array' , ( ) => {
75+ expect ( defaultPreferedLangages ) . toBeInstanceOf ( Array )
76+ } )
77+ it ( 'exists as a array' , ( ) => {
78+ expect ( defaultPreferedLangages ) . toEqual ( expectedDefaults )
79+ } )
80+ } )
81+
7182describe ( 'getPreferredLanagugesFor' , ( ) => {
7283 it ( 'exists as a function' , ( ) => {
7384 expect ( getPreferredLanagugesFor ) . toBeInstanceOf ( Function )
7485 } )
7586 it ( 'returns just greek for Alice, plus deafults' , async ( ) => {
7687 const result = await getPreferredLanagugesFor ( alice )
77- expect ( result ) . toEqual ( [ 'el' ] . concat ( [ 'en' , 'fr' , 'de' , 'it' , 'ar' ] ) ) // toMatchSnapshot()
88+ expect ( result ) . toEqual ( [ 'el' ] . concat ( [ 'en' , 'fr' , 'de' , 'it' , 'ar' ] ) )
7889 } )
79- it ( 'returns just greek for Bob, plus deafults' , async ( ) => {
90+ it ( 'returns english, french Bob, plus deafults' , async ( ) => {
8091 const result = await getPreferredLanagugesFor ( bob )
81- expect ( result ) . toEqual ( [ 'en' , 'fr' , 'de' , 'it' , 'ar' ] ) // toMatchSnapshot()
92+ expect ( result ) . toEqual ( [ 'en' , 'fr' , 'de' , 'it' , 'ar' ] )
93+ } )
94+ it ( 'returns nothing for Charlie, plus deafults' , async ( ) => {
95+ const result = await getPreferredLanagugesFor ( charlie )
96+ expect ( result ) . toEqual ( expectedDefaults )
8297 } )
8398} )
8499//
0 commit comments