Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick committed Nov 6, 2023
1 parent efaea40 commit 3e70171
Show file tree
Hide file tree
Showing 24 changed files with 776 additions and 1,592 deletions.
2,228 changes: 719 additions & 1,509 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"dependencies": {
"@lit/context": "^1.0.0",
"@lit/react": "^1.0.0",
"@storybook/preview-api": "^7.5.2",
"cheerio": "^1.0.0-rc.12",
"lit": "^3.0.0"
},
Expand All @@ -93,17 +94,17 @@
"@arethetypeswrong/cli": "^0.12.2",
"@custom-elements-manifest/analyzer": "^0.9.0",
"@jest/globals": "^29.7.0",
"@storybook/addon-a11y": "^7.5.1",
"@storybook/addon-essentials": "^7.5.1",
"@storybook/addon-interactions": "^7.5.1",
"@storybook/addon-jest": "^7.5.1",
"@storybook/addon-links": "^7.5.1",
"@storybook/blocks": "^7.5.1",
"@storybook/addon-a11y": "^7.5.2",
"@storybook/addon-essentials": "^7.5.2",
"@storybook/addon-interactions": "^7.5.2",
"@storybook/addon-jest": "^7.5.2",
"@storybook/addon-links": "^7.5.2",
"@storybook/blocks": "^7.5.2",
"@storybook/jest": "^0.2.3",
"@storybook/test-runner": "^0.13.0",
"@storybook/testing-library": "^0.2.2",
"@storybook/web-components": "^7.5.1",
"@storybook/web-components-vite": "^7.5.1",
"@storybook/web-components": "^7.5.2",
"@storybook/web-components-vite": "^7.5.2",
"@tailwindcss/nesting": "^0.0.0-insiders.565cd3e",
"@tailwindcss/typography": "^0.5.10",
"@types/node": "^20.8.8",
Expand Down Expand Up @@ -132,7 +133,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"remark-gfm": "^4.0.0",
"storybook": "^7.5.1",
"storybook": "^7.5.2",
"tailwindcss": "^3.3.2",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import '@citolab/qti-components/qti-components';
import { describe, expect, it } from '@jest/globals';
import crypto from 'crypto';
import { render } from 'lit';
import '../qti-simple-choice';
import './qti-choice-interaction';
import { Default } from './qti-choice-interaction.stories';

// FIXME: Check if this is still needed, only when using choice this should be available
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import '@citolab/qti-components/qti-components';
import { describe, expect, it } from '@jest/globals';
import { html, render } from 'lit';
import { QtiAssessmentItem } from '../../../qti-assessment-item/qti-assessment-item';
import { QtiContains } from './qti-contains';
import { describe, expect, it } from '@jest/globals';
import '../../../index';

describe('qti-contains', () => {
it('should check if the variable identified in the first child is contained in the second one', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../../../index';
import { QtiCorrect } from './qti-correct';
import { html, render } from 'lit';
import '@citolab/qti-components/qti-components';
import { describe, expect, it } from '@jest/globals';
import { html, render } from 'lit';
import { QtiCorrect } from './qti-correct';
describe('qti-correct', () => {
it('should return value in the correct baseType(float)', () => {
const correctValue = 'A';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { QtiEqualRounded } from './qti-equal-rounded';
import '@citolab/qti-components/qti-components';
import { html, render } from 'lit';
import { QtiAssessmentItem } from '../../../qti-assessment-item/qti-assessment-item';
import '../../../index';
import { QtiEqualRounded } from './qti-equal-rounded';

describe('qti-equal-rounded', () => {
it('rounded 3 decimals equal', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { QtiEqual } from './qti-equal';
import '@citolab/qti-components/qti-components';
import { html, render } from 'lit';
import { QtiAssessmentItem } from '../../../qti-assessment-item/qti-assessment-item';
import '../../../index';
import { QtiEqual } from './qti-equal';

describe('qti-equal', () => {
it('response and correct response match', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../../../index';
import '@citolab/qti-components/qti-components';
import { describe, expect } from '@jest/globals';
import { QtiGt } from './qti-gt';
import { html, render } from 'lit';
import { QtiGt } from './qti-gt';
describe('qti-gt', () => {
it('equal = false', () => {
const template = () => html`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../../../index';
import '@citolab/qti-components/qti-components';
import { describe, expect } from '@jest/globals';
import { QtiGte } from './qti-gte';
import { html, render } from 'lit';
import { QtiGte } from './qti-gte';
describe('qti-gte', () => {
it('equal = true', () => {
const template = () => html`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import '../../../index';
import '@citolab/qti-components/qti-components';

import { QtiIsNull } from './qti-is-null';
import { html, render } from 'lit';
import { describe, expect, it } from '@jest/globals';
import { html, render } from 'lit';
import { QtiIsNull } from './qti-is-null';
describe('qti-is-null', () => {
it('null = true', () => {
const template = () => html`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../../../index';
import '@citolab/qti-components/qti-components';
import { describe, expect } from '@jest/globals';
import { QtiLt } from './qti-lt';
import { html, render } from 'lit';
import { QtiLt } from './qti-lt';
describe('qti-gt', () => {
it('equal = false', () => {
const template = () => html`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../../../index';
import '@citolab/qti-components/qti-components';
import { describe, expect } from '@jest/globals';
import { QtiLte } from './qti-lte';
import { html, render } from 'lit';
import { QtiLte } from './qti-lte';
describe('qti-lte', () => {
it('equal = true', () => {
const template = () => html`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { QtiMapResponse } from './qti-map-response';
import '@citolab/qti-components/qti-components';
import { describe, expect, it } from '@jest/globals';
import { html, render } from 'lit';
import { ResponseVariable } from '../../../internal/variables';
import { QtiAssessmentItem } from '../../../qti-assessment-item/qti-assessment-item';
import { describe, expect, it } from '@jest/globals';
import '../../../index';

import { QtiMapResponse } from './qti-map-response';
describe('qti-map-response', () => {
it('should the value of the mapping by response value', () => {
const template = () => html`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../../../index';
import '@citolab/qti-components/qti-components';

import { describe, expect, it } from '@jest/globals';
import { html, render } from 'lit';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { QtiMatch } from './qti-match';
import '@citolab/qti-components/qti-components';
import { describe, expect, it } from '@jest/globals';
import { html, render } from 'lit';
import { QtiAssessmentItem } from '../../../qti-assessment-item/qti-assessment-item';
import { ResponseVariable } from '../../../internal/variables';
import { describe, expect, it } from '@jest/globals';
import '../../../index';
import { QtiMatch } from './qti-match';

describe('qti-match', () => {
it('should check if the variable identified in the first child is contained in the second one', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '@citolab/qti-components/qti-components';
import { describe, expect, it } from '@jest/globals';
import { html, render } from 'lit';
import { QtiMember } from './qti-member';
import { describe, expect, it } from '@jest/globals';
import '../../../index';

describe('qti-contains', () => {
const failTemplate = () => html`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { QtiProduct } from './qti-product';
import '@citolab/qti-components/qti-components';
import { html, render } from 'lit';
import { QtiAssessmentItem } from '../../../qti-assessment-item/qti-assessment-item';
import '../../../index';
import { QtiProduct } from './qti-product';

describe('qti-product', () => {
it('multiplies, the product of one or more variables', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { QtiStringMatch } from './qti-string-match';
import '@citolab/qti-components/qti-components';
import { html, render } from 'lit';
import { QtiAssessmentItem } from '../../../qti-assessment-item/qti-assessment-item';
import '../../../index';

import { QtiStringMatch } from './qti-string-match';
describe('qti-string-match', () => {
it('response and correct response match', () => {
const template = () => html`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import '@citolab/qti-components/qti-components';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { html, render } from 'lit';
import { QtiAssessmentItem } from '../../qti-assessment-item/qti-assessment-item';
import { describe, expect, it, beforeEach } from '@jest/globals';
import '../../index';
import { ResponseInteraction } from '../../index';

const match_correct_item = html` <qti-assessment-item identifier="choice" title="Unattended Luggage">
<qti-response-declaration identifier="RESPONSE" cardinality="single" base-type="identifier">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import '@citolab/qti-components/qti-components';
import { beforeEach, describe, expect, it } from '@jest/globals';
import { html, render } from 'lit';
import { QtiAssessmentItem } from '../../qti-assessment-item/qti-assessment-item';
import { describe, expect, it, beforeEach } from '@jest/globals';
import '../../index';
import { ResponseInteraction } from '../../index';

// import { unitTestItem } from "./qti-responseprocessing-map-response.stories";
const unitTestItem = html`<qti-assessment-item
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { within } from '@storybook/testing-library';
import type { Meta, StoryObj } from '@storybook/web-components';
import { html } from 'lit';

import { qtiTransformItem } from '@citolab/qti-components/qti-transformers';
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
import { qtiTransformItem } from 'src/lib/qti-transformers';

import storyXML from './qti-lookup-outcome-value.xml?raw';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

import '@citolab/qti-components/qti-components';
import { QtiAssessmentItem, QtiLookupOutcomeValue } from '@citolab/qti-components/qti-components';
import { render } from 'lit';
import './qti-lookup-outcome-value';
import { Default } from './qti-lookup-outcome-value.stories';
import { expect } from '@storybook/jest';
import { Default } from './qti-lookup-outcome-value.stories';

import { composeStory } from '@storybook/preview-api';
import { render } from 'lit';

// import { composeStory } from '@storybook/web-components';
// const FormError = composeStory(DefaultStory, Meta);
const composedStory = composeStory(Default, Default.args);

test('Checks if the form is valid', () => {
render(Default.render({ maxChoices: 1, minChoices: 1 }), document.body);
render(composedStory.toString(), document.body);

const assessmentItem = document.body.querySelector('qti-assessment-item') as QtiAssessmentItem;
assessmentItem.updateResponseVariable('SCORE', '3');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { OutcomeVariable, QtiExpression, QtiRule } from '@citolab/qti-components/qti-components';
import { customElement, property } from 'lit/decorators.js';
import { convertNumberToUniveralFormat } from 'src/lib/qti-components/internal/utils';
import { convertNumberToUniveralFormat } from '../../../internal/utils';

/**
* The lookupOutcomeValue rule sets the value of an outcome variable to the value obtained
Expand Down

0 comments on commit 3e70171

Please sign in to comment.