diff --git a/projects/ngx-xapi/model/src/lib/about.spec.ts b/projects/ngx-xapi/model/src/lib/about.spec.ts new file mode 100644 index 0000000..e298e8c --- /dev/null +++ b/projects/ngx-xapi/model/src/lib/about.spec.ts @@ -0,0 +1,14 @@ +import { About } from './about'; + +describe('About', () => { + it('should create an instance', () => { + const about: About = { + version: ['1.0.0', '1.0.1', '1.0.2', '1.0.3'], + extensions: { + 'https://learning.dev/lrs': true, + }, + }; + + expect(about).toBeTruthy(); + }); +}); diff --git a/projects/ngx-xapi/model/src/lib/account.spec.ts b/projects/ngx-xapi/model/src/lib/account.spec.ts new file mode 100644 index 0000000..29395eb --- /dev/null +++ b/projects/ngx-xapi/model/src/lib/account.spec.ts @@ -0,0 +1,12 @@ +import { Account } from './account'; + +describe('Account', () => { + it('should create an instance', () => { + const account: Account = { + homePage: 'http://example.com', + name: 'Example Account', + }; + + expect(account).toBeTruthy(); + }); +}); diff --git a/projects/ngx-xapi/model/src/lib/activity.spec.ts b/projects/ngx-xapi/model/src/lib/activity.spec.ts new file mode 100644 index 0000000..f282de9 --- /dev/null +++ b/projects/ngx-xapi/model/src/lib/activity.spec.ts @@ -0,0 +1,361 @@ +import { + Activity, + ActivityDefinition, + ChoiceInteractionActivityDefinition, + FillInInteractionActivityDefinition, + InteractionComponent, + LikertInteractionActivityDefinition, + LongFillInInteractionActivityDefinition, + MatchingInteractionActivityDefinition, + NumericInteractionActivityDefinition, + OtherInteractionActivityDefinition, + PerformanceInteractionActivityDefinition, + SequencingInteractionActivityDefinition, + TrueFalseInteractionActivityDefinition, +} from './activity'; + +describe('ActivityDefinition', () => { + it('should create an instance', () => { + const activityDefinition: ActivityDefinition = { + name: { + en: 'Example Activity', + }, + description: { + en: 'Example Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + interactionType: 'other', + correctResponsesPattern: ['Example Correct Response Pattern'], + choices: [ + { + id: 'http://example.com/choices/example-choice', + description: { + en: 'Example Choice Description', + }, + }, + ], + scale: [ + { + id: 'http://example.com/scales/example-scale', + description: { + en: 'Example Scale Description', + }, + }, + ], + source: [ + { + id: 'http://example.com/sources/example-source', + description: { + en: 'Example Source Description', + }, + }, + ], + target: [ + { + id: 'http://example.com/targets/example-target', + description: { + en: 'Example Target Description', + }, + }, + ], + steps: [ + { + id: 'http://example.com/steps/example-step', + description: { + en: 'Example Step Description', + }, + }, + ], + extensions: { + 'http://example.com/extensions/example-extension': + 'Example Extension Value', + }, + }; + + expect(activityDefinition).toBeTruthy(); + }); +}); + +describe('InteractionComponent', () => { + it('should create an instance', () => { + const interactionComponent: InteractionComponent = { + id: 'http://example.com/interaction-component', + description: { + en: 'Example Interaction Component Description', + }, + }; + + expect(interactionComponent).toBeTruthy(); + }); +}); + +describe('TrueFalseInteractionActivityDefinition', () => { + it('should create an instance', () => { + const trueFalseInteractionActivityDefinition: TrueFalseInteractionActivityDefinition = + { + name: { + en: 'Example True/False Activity', + }, + description: { + en: 'Example True/False Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + interactionType: 'true-false', + correctResponsesPattern: ['true'], + }; + + expect(trueFalseInteractionActivityDefinition).toBeTruthy(); + }); +}); + +describe('ChoiceInteractionActivityDefinition', () => { + it('should create an instance', () => { + const choiceInteractionActivityDefinition: ChoiceInteractionActivityDefinition = + { + name: { + en: 'Example Choice Activity', + }, + description: { + en: 'Example Choice Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + interactionType: 'choice', + choices: [ + { + id: 'http://example.com/choices/example-choice', + description: { + en: 'Example Choice Description', + }, + }, + ], + }; + + expect(choiceInteractionActivityDefinition).toBeTruthy(); + }); +}); + +describe('FillInInteractionActivityDefinition', () => { + it('should create an instance', () => { + const fillInInteractionActivityDefinition: FillInInteractionActivityDefinition = + { + name: { + en: 'Example Fill-In Activity', + }, + description: { + en: 'Example Fill-In Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + interactionType: 'fill-in', + correctResponsesPattern: ['Example Correct Response Pattern'], + }; + + expect(fillInInteractionActivityDefinition).toBeTruthy(); + }); +}); + +describe('LongFillInInteractionActivityDefinition', () => { + it('should create an instance', () => { + const longFillInInteractionActivityDefinition: LongFillInInteractionActivityDefinition = + { + name: { + en: 'Example Long Fill-In Activity', + }, + description: { + en: 'Example Long Fill-In Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + interactionType: 'long-fill-in', + correctResponsesPattern: ['Example Correct Response Pattern'], + }; + + expect(longFillInInteractionActivityDefinition).toBeTruthy(); + }); +}); + +describe('MatchingInteractionActivityDefinition', () => { + it('should create an instance', () => { + const matchingInteractionActivityDefinition: MatchingInteractionActivityDefinition = + { + name: { + en: 'Example Matching Activity', + }, + description: { + en: 'Example Matching Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + interactionType: 'matching', + source: [ + { + id: 'http://example.com/sources/example-source', + description: { + en: 'Example Source Description', + }, + }, + ], + target: [ + { + id: 'http://example.com/targets/example-target', + description: { + en: 'Example Target Description', + }, + }, + ], + }; + + expect(matchingInteractionActivityDefinition).toBeTruthy(); + }); +}); + +describe('PerformanceInteractionActivityDefinition', () => { + it('should create an instance', () => { + const performanceInteractionActivityDefinition: PerformanceInteractionActivityDefinition = + { + name: { + en: 'Example Performance Activity', + }, + description: { + en: 'Example Performance Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + interactionType: 'performance', + steps: [ + { + id: 'http://example.com/steps/example-step', + description: { + en: 'Example Step Description', + }, + }, + ], + }; + + expect(performanceInteractionActivityDefinition).toBeTruthy(); + }); +}); + +describe('SequencingInteractionActivityDefinition', () => { + it('should create an instance', () => { + const sequencingInteractionActivityDefinition: SequencingInteractionActivityDefinition = + { + name: { + en: 'Example Sequencing Activity', + }, + description: { + en: 'Example Sequencing Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + interactionType: 'sequencing', + correctResponsesPattern: ['Example Correct Response Pattern'], + choices: [ + { + id: 'http://example.com/choices/example-choice1', + description: { + en: 'Example Choice Description 1', + }, + }, + { + id: 'http://example.com/choices/example-choice2', + description: { + en: 'Example Choice Description 2', + }, + }, + ], + }; + + expect(sequencingInteractionActivityDefinition).toBeTruthy(); + }); +}); + +describe('LikertInteractionActivityDefinition', () => { + it('should create an instance', () => { + const likertInteractionActivityDefinition: LikertInteractionActivityDefinition = + { + name: { + en: 'Example Likert Activity', + }, + description: { + en: 'Example Likert Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + interactionType: 'likert', + scale: [ + { + id: 'http://example.com/scales/example-scale', + description: { + en: 'Example Scale Description', + }, + }, + ], + }; + + expect(likertInteractionActivityDefinition).toBeTruthy(); + }); +}); + +describe('NumericInteractionActivityDefinition', () => { + it('should create an instance', () => { + const numericInteractionActivityDefinition: NumericInteractionActivityDefinition = + { + name: { + en: 'Example Numeric Activity', + }, + description: { + en: 'Example Numeric Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + correctResponsesPattern: ['Example Correct Response Pattern'], + interactionType: 'numeric', + }; + + expect(numericInteractionActivityDefinition).toBeTruthy(); + }); +}); + +describe('OtherInteractionActivityDefinition', () => { + it('should create an instance', () => { + const otherInteractionActivityDefinition: OtherInteractionActivityDefinition = + { + name: { + en: 'Example Other Activity', + }, + description: { + en: 'Example Other Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + interactionType: 'other', + }; + + expect(otherInteractionActivityDefinition).toBeTruthy(); + }); +}); + +describe('Activity', () => { + it('should create an instance', () => { + const activity: Activity = { + id: 'http://example.com/activities/example-activity', + definition: { + name: { + en: 'Example Activity', + }, + description: { + en: 'Example Activity Description', + }, + type: 'http://adlnet.gov/expapi/activities/cmi.interaction', + moreInfo: 'http://example.com', + interactionType: 'other', + }, + }; + + expect(activity).toBeTruthy(); + }); +}); diff --git a/projects/ngx-xapi/model/src/lib/actor.spec.ts b/projects/ngx-xapi/model/src/lib/actor.spec.ts new file mode 100644 index 0000000..78bf697 --- /dev/null +++ b/projects/ngx-xapi/model/src/lib/actor.spec.ts @@ -0,0 +1,155 @@ +import { Agent, AnonymousGroup, IdentifiedGroup } from './actor'; + +describe('Agent', () => { + it('should create an instance with mbox', () => { + const agent: Agent = { + mbox: 'mailto:agent@example.com', + name: 'Example Agent', + }; + + expect(agent).toBeTruthy(); + }); + + it('should create an instance with mbox_sha1sum', () => { + const agent: Agent = { + name: 'Example Agent', + mbox_sha1sum: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + }; + + expect(agent).toBeTruthy(); + }); + + it('should create an instance with openid', () => { + const agent: Agent = { + name: 'Example Agent', + openid: 'https://example.com', + }; + + expect(agent).toBeTruthy(); + }); + + it('should create an instance with account', () => { + const agent: Agent = { + name: 'Example Agent', + account: { + homePage: 'http://example.com', + name: 'Example Account', + }, + }; + + expect(agent).toBeTruthy(); + }); +}); + +describe('AnonymousGroup', () => { + it('should create an instance with member', () => { + const anonymousGroup: AnonymousGroup = { + member: [ + { + mbox: 'mailto:member1@example.com', + name: 'Member 1', + }, + { + mbox: 'mailto:member2@example.com', + name: 'Member 2', + }, + ], + + objectType: 'Group', + name: 'Example Group', + }; + + expect(anonymousGroup).toBeTruthy(); + }); +}); + +describe('IdentifiedGroup', () => { + it('should create an instance with member', () => { + const identifiedGroup: IdentifiedGroup = { + member: [ + { + mbox: 'mailto:member1@example.com', + name: 'Member 1', + }, + { + mbox: 'mailto:member2@example.com', + name: 'Member 2', + }, + ], + + objectType: 'Group', + name: 'Example Group', + account: { + homePage: 'http://example.com', + name: 'Example Group Account', + }, + }; + + expect(identifiedGroup).toBeTruthy(); + }); + + it('should create an instance without member', () => { + const identifiedGroup: IdentifiedGroup = { + objectType: 'Group', + name: 'Example Group', + openid: 'https://example.com/group', + }; + + expect(identifiedGroup).toBeTruthy(); + }); +}); + +describe('Actor', () => { + it('should create an instance as Agent', () => { + const actor: Agent = { + mbox: 'mailto:agent@example.com', + name: 'Example Agent', + }; + + expect(actor).toBeTruthy(); + }); + + it('should create an instance as AnonymousGroup', () => { + const actor: AnonymousGroup = { + member: [ + { + mbox: 'mailto:member1@example.com', + name: 'Member 1', + }, + { + mbox: 'mailto:member2@example.com', + name: 'Member 2', + }, + ], + + objectType: 'Group', + name: 'Example Group', + }; + + expect(actor).toBeTruthy(); + }); + + it('should create an instance as IdentifiedGroup', () => { + const actor: IdentifiedGroup = { + member: [ + { + openid: 'https://example.com/member1', + name: 'Member 1', + }, + { + openid: 'https://example.com/member2', + name: 'Member 2', + }, + ], + + objectType: 'Group', + name: 'Example Group', + account: { + homePage: 'http://example.com', + name: 'Example Group Account', + }, + }; + + expect(actor).toBeTruthy(); + }); +}); diff --git a/projects/ngx-xapi/model/src/lib/attachment.spec.ts b/projects/ngx-xapi/model/src/lib/attachment.spec.ts new file mode 100644 index 0000000..786537b --- /dev/null +++ b/projects/ngx-xapi/model/src/lib/attachment.spec.ts @@ -0,0 +1,17 @@ +import { Attachment } from './attachment'; + +describe('Attachment', () => { + it('should create an instance', () => { + const attachment: Attachment = { + usageType: 'http://adlnet.gov/expapi/attachments/signature', + display: { + en: 'Signature', + }, + contentType: 'application/octet-stream', + length: 0, + sha2: '1234567890abcdef', + }; + + expect(attachment).toBeTruthy(); + }); +}); diff --git a/projects/ngx-xapi/model/src/lib/person.spec.ts b/projects/ngx-xapi/model/src/lib/person.spec.ts new file mode 100644 index 0000000..dd9056d --- /dev/null +++ b/projects/ngx-xapi/model/src/lib/person.spec.ts @@ -0,0 +1,28 @@ +import { Person } from './person'; + +describe('Person', () => { + it('should create an instance', () => { + const person: Person = { + name: ['Example Person', 'Alias Person'], + mbox: ['mailto:person@example.com', 'mailto:alias@example.com'], + account: [ + { + homePage: 'http://example.com', + name: 'Example Person Account', + }, + { + homePage: 'http://example.com', + name: 'Alias Person Account', + }, + ], + openid: ['https://example.com/person', 'https://example.com/alias'], + mbox_sha1sum: [ + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', + ], + objectType: 'Person', + }; + + expect(person).toBeTruthy(); + }); +}); diff --git a/projects/ngx-xapi/model/src/lib/result.spec.ts b/projects/ngx-xapi/model/src/lib/result.spec.ts new file mode 100644 index 0000000..b3b1704 --- /dev/null +++ b/projects/ngx-xapi/model/src/lib/result.spec.ts @@ -0,0 +1,23 @@ +import { Result } from './result'; + +describe('Result', () => { + it('should create an instance', () => { + const result: Result = { + score: { + scaled: 0.5, + raw: 50, + min: 0, + max: 100, + }, + success: true, + completion: true, + response: 'Example Response', + duration: 'PT1H', + extensions: { + 'https://learning.dev/lrs': true, + }, + }; + + expect(result).toBeTruthy(); + }); +}); diff --git a/projects/ngx-xapi/model/src/lib/statement.spec.ts b/projects/ngx-xapi/model/src/lib/statement.spec.ts new file mode 100644 index 0000000..3f36672 --- /dev/null +++ b/projects/ngx-xapi/model/src/lib/statement.spec.ts @@ -0,0 +1,67 @@ +import { Statement } from './statement'; + +describe('Statement', () => { + it('should create an instance', () => { + const statement: Statement = { + id: '45e6dec1-789c-40ff-8f9b-a9428b33230d', + actor: { + mbox: 'mailto:sss@example.com', + name: 'Example Actor', + objectType: 'Agent', + }, + verb: { + id: 'http://adlnet.gov/expapi/verbs/experienced', + display: { + en: 'experienced', + }, + }, + object: { + id: 'http://example.com/activities/example-activity', + }, + result: { + completion: true, + success: true, + score: { + scaled: 0.95, + raw: 95, + min: 0, + max: 100, + }, + }, + context: { + registration: 'ec531277-b57b-4c15-8d91-d292c5b2b8f7', + contextActivities: { + parent: [ + { + id: 'http://example.com/activities/example-activity', + }, + ], + }, + }, + authority: { + mbox: 'mailto:bob@example.com', + name: 'Bob', + objectType: 'Agent', + }, + version: '1.0.0', + timestamp: '2021-01-01T00:00:00.000Z', + stored: '2021-01-01T00:00:00.000Z', + attachments: [ + { + usageType: 'http://example.com/attachment-usage/example-usage', + display: { + en: 'Example Attachment', + }, + description: { + en: 'Example Attachment Description', + }, + contentType: 'text/plain', + length: 0, + sha2: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + }, + ], + }; + + expect(statement).toBeTruthy(); + }); +}); diff --git a/projects/ngx-xapi/model/src/lib/verb.spec.ts b/projects/ngx-xapi/model/src/lib/verb.spec.ts new file mode 100644 index 0000000..6878a5d --- /dev/null +++ b/projects/ngx-xapi/model/src/lib/verb.spec.ts @@ -0,0 +1,14 @@ +import { Verb } from './verb'; + +describe('Verb', () => { + it('should create an instance', () => { + const verb: Verb = { + id: 'http://adlnet.gov/expapi/verbs/answered', + display: { + en: 'answered', + }, + }; + + expect(verb).toBeTruthy(); + }); +});