Skip to content

Commit 38f650b

Browse files
committed
lib changes and updates and test version1
1 parent 255fa5d commit 38f650b

5 files changed

Lines changed: 35 additions & 35 deletions

File tree

src/create/create.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
**
33
*/
44

5+
// import { logInLoadProfile, selectWorkspace } from '../authn/authn'
6+
import { DataBrowserContext, NewPaneOptions, PaneDefinition } from 'pane-registry'
7+
import { solidLogicSingleton } from 'solid-logic'
58
import * as debug from '../debug'
69
import { icons } from '../iconBase'
10+
import { loggedInContext, selectWorkspace } from '../login/login'
11+
import * as ns from '../ns'
712
import * as utils from '../utils'
813
import * as widgets from '../widgets'
9-
import * as ns from '../ns'
10-
import { authn, solidLogicSingleton } from 'solid-logic'
11-
import { loggedInContext, selectWorkspace } from '../login/login'
12-
// import { logInLoadProfile, selectWorkspace } from '../authn/authn'
13-
import { DataBrowserContext, NewPaneOptions, PaneDefinition } from 'pane-registry'
1414
import { CreateContext, NewAppInstanceOptions } from './types'
1515

1616
const kb = solidLogicSingleton.store

src/login/login.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { textInputStyle, buttonStyle, commentStyle } from '../style'
2929
// eslint-disable-next-line camelcase
3030
import { Quad_Object } from 'rdflib/lib/tf-types'
3131
import { BlankNode, IndexedFormula, NamedNode, st, Statement, sym } from 'rdflib'
32-
import { authn, AppDetails, AuthenticationContext, solidLogicSingleton, offlineTestID, typeIndexLogic, authSession, getSuggestedIssuers } from 'solid-logic'
32+
import { authn, AppDetails, AuthenticationContext, solidLogicSingleton, authUtil, typeIndexLogic, authSession, getSuggestedIssuers } from 'solid-logic'
3333
import { utils } from '../utils/index'
3434

3535
/**
@@ -384,7 +384,7 @@ function signInOrSignUpBox (
384384
})
385385

386386
signInPopUpButton.addEventListener('click', () => {
387-
const offline = offlineTestID()
387+
const offline = authUtil.offlineTestID()
388388
if (offline) return setUserCallback(offline.uri)
389389

390390
renderSignInPopup(dom)
@@ -564,7 +564,7 @@ export function loginStatusBox (
564564
} = {}
565565
): HTMLElement {
566566
// 20190630
567-
let me = offlineTestID()
567+
let me = authUtil.offlineTestID()
568568
// @@ TODO Remove the need to cast HTML element to any
569569
const box: any = dom.createElement('div')
570570

@@ -706,7 +706,7 @@ export function selectWorkspace (
706706
const noun = appDetails.noun
707707
const appPathSegment = appDetails.appPathSegment
708708

709-
const me = offlineTestID()
709+
const me = authUtil.offlineTestID()
710710
const box = dom.createElement('div')
711711
let context: AuthenticationContext = { me: me, dom: dom, div: box }
712712

src/widgets/forms/autocomplete/publicData.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
* See https://solidos.solidcommunity.net/public/2021/01%20Building%20Solid%20Apps%20which%20use%20Public%20Data.html
55
*/
66
/* eslint-disable no-console */
7-
import { NamedNode, Literal, parse, IndexedFormula } from 'rdflib'
7+
import { Literal, NamedNode, parse } from 'rdflib'
8+
import { store } from 'solid-logic'
89
import * as debug from '../../../debug'
910
import * as ns from '../../../ns'
10-
import { store } from 'solid-logic'
11-
import { getPreferredLanguages, defaultPreferredLanguages } from './language'
11+
import { defaultPreferredLanguages, getPreferredLanguages } from './language'
1212

1313
export const AUTOCOMPLETE_LIMIT = 200 // How many to get from server
1414
// With 3000 we could exceed the wikidata timeout

src/widgets/forms/basic.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { st, BlankNode, Literal, Node, NamedNode, Variable, Store, IndexedFormula } from 'rdflib'
1+
import { BlankNode, Literal, NamedNode, Node, st, Store, Variable } from 'rdflib'
22
import { solidLogicSingleton } from 'solid-logic'
33
import * as ns from '../../ns'
4-
import { textInputSize, textInputStyle, textInputStyleUneditable, formFieldNameBoxWidth, formFieldNameBoxStyle } from '../../style'
4+
import { formFieldNameBoxStyle, formFieldNameBoxWidth, textInputSize, textInputStyle, textInputStyleUneditable } from '../../style'
55
import { label } from '../../utils'
66
import { errorMessageBlock } from '../error'
77
import { mostSpecificClassURI } from './fieldFunction'

test/unit/login/login.test.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
import * as testAuthn from "../src/authn/authn";
1+
import * as testLogin from '../../../src/login/login'
2+
import { authUtil } from 'solid-logic'
23

34
const mockAppContext = {
4-
viewingNoAuthPage: true,
5-
webId: "https://timea-test.solidcommunity.net/profile/card#me"
5+
viewingNoAuthPage: true,
6+
webId: 'https://timea-test.solidcommunity.net/profile/card#me'
67
}
78

89
describe('logIn', () => {
9-
afterAll(() => {
10-
jest.restoreAllMocks()
11-
})
12-
it('exists', () => {
13-
expect(testAuthn.logIn).toBeInstanceOf(Function)
14-
})
15-
it('runs', () => {
16-
expect(testAuthn.logIn({})).toBeInstanceOf(Object)
17-
})
18-
it('user logged in already, through appContext', async () => {
19-
jest.spyOn(testAuthn, 'appContext').mockReturnValue(mockAppContext)
20-
const call = await testAuthn.logIn({})
21-
expect(call).toBeInstanceOf(Object)
22-
console.log(call)
23-
expect(testAuthn.appContext).toHaveBeenCalledTimes(1);
24-
25-
})
26-
})
10+
afterAll(() => {
11+
jest.restoreAllMocks()
12+
})
13+
it('exists', () => {
14+
expect(testLogin.loggedInContext).toBeInstanceOf(Function)
15+
})
16+
it('runs', () => {
17+
expect(testLogin.loggedInContext({})).toBeInstanceOf(Object)
18+
})
19+
it('user logged in already, through appContext', async () => {
20+
jest.spyOn(authUtil, 'appContext').mockReturnValue(mockAppContext)
21+
const call = await testLogin.loggedInContext({})
22+
expect(call).toBeInstanceOf(Object)
23+
// console.log(call)
24+
// expect(authUtil.appContext).toHaveBeenCalledTimes(1)
25+
})
26+
})

0 commit comments

Comments
 (0)