From dd809242b1ccb151bffe5eae8e73449671feb155 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Thu, 24 Mar 2022 16:04:29 +0700 Subject: [PATCH] Test fixes (#1197) Signed-off-by: Andrey Sobolev --- .../src/components/Channels.svelte | 28 +++--- .../src/components/OrganizationEditor.svelte | 1 - .../components/OrganizationSelector.svelte | 11 ++- .../src/components/CreateApplication.svelte | 2 +- .../src/components/CreateCandidate.svelte | 8 +- .../src/components/review/EditReview.svelte | 19 +--- .../src/components/statuses/Templates.svelte | 4 +- .../src/components/TagsEditor.svelte | 2 +- .../src/components/TagsPopup.svelte | 2 +- .../src/components/CreateTask.svelte | 2 +- .../src/components/Templates.svelte | 2 +- .../src/components/Table.svelte | 2 +- .../src/components/Workbench.svelte | 2 +- .../components/navigator/TreeElement.svelte | 2 +- server/mongo/src/storage.ts | 6 +- tests/build-reload.sh | 9 ++ tests/sanity/package.json | 4 +- tests/sanity/storage.json | 26 +++++ tests/sanity/tests/contacts.spec.ts | 67 +++++++++++-- tests/sanity/tests/recruit.spec.ts | 93 ++++++++++++----- tests/sanity/tests/settings.spec.ts | 99 +++++++++++++++++++ tests/sanity/tests/tags.spec.ts | 99 +++++++++++++++++++ tests/sanity/tests/utils.ts | 35 +++++++ 23 files changed, 439 insertions(+), 86 deletions(-) create mode 100755 tests/build-reload.sh create mode 100644 tests/sanity/storage.json create mode 100644 tests/sanity/tests/settings.spec.ts create mode 100644 tests/sanity/tests/tags.spec.ts diff --git a/plugins/contact-resources/src/components/Channels.svelte b/plugins/contact-resources/src/components/Channels.svelte index 70561c7599..8c675cefda 100644 --- a/plugins/contact-resources/src/components/Channels.svelte +++ b/plugins/contact-resources/src/components/Channels.svelte @@ -30,21 +30,23 @@ {#if channels?.length === 0} - - showPopup(contact.component.SocialEditor, { values: channels }, ev.target, (result) => { - if (result !== undefined) { - dispatch('change', result) - } - })} - /> - +
+ + showPopup(contact.component.SocialEditor, { values: channels }, ev.target, (result) => { + if (result !== undefined) { + dispatch('change', result) + } + })} + /> + +
{:else} -
+
-
{ if (!opened) { opened = true diff --git a/plugins/contact-resources/src/components/OrganizationSelector.svelte b/plugins/contact-resources/src/components/OrganizationSelector.svelte index 80a1063cd7..20f4549dfb 100644 --- a/plugins/contact-resources/src/components/OrganizationSelector.svelte +++ b/plugins/contact-resources/src/components/OrganizationSelector.svelte @@ -30,6 +30,10 @@ const query = createQuery() const dispatch = createEventDispatcher() + let items: ListItem[] = [] + let selected: ListItem | undefined + let resolved = false + query.query(contact.class.Organization, {}, (res) => { items = res.map((org) => { return { @@ -41,12 +45,13 @@ if (value !== undefined) { selected = items.find((p) => p._id === value) } + resolved = true }) - let items: ListItem[] = [] - let selected: ListItem | undefined - $: setValue(selected) + $: if (resolved) { + setValue(selected) + } function setValue (selected: ListItem | undefined): void { if (selected === undefined) { diff --git a/plugins/recruit-resources/src/components/CreateApplication.svelte b/plugins/recruit-resources/src/components/CreateApplication.svelte index 23d755e3f8..46cde9d39e 100644 --- a/plugins/recruit-resources/src/components/CreateApplication.svelte +++ b/plugins/recruit-resources/src/components/CreateApplication.svelte @@ -60,7 +60,7 @@ async function createApplication () { const state = await client.findOne(task.class.State, { space: doc.space }) if (state === undefined) { - throw new Error('create application: state not found') + throw new Error(`create application: state not found space:${doc.space}`) } const sequence = await client.findOne(task.class.Sequence, { attachedTo: recruit.class.Applicant }) if (sequence === undefined) { diff --git a/plugins/recruit-resources/src/components/CreateCandidate.svelte b/plugins/recruit-resources/src/components/CreateCandidate.svelte index f978a51669..867db73243 100644 --- a/plugins/recruit-resources/src/components/CreateCandidate.svelte +++ b/plugins/recruit-resources/src/components/CreateCandidate.svelte @@ -23,15 +23,13 @@ Data, Doc, FindResult, - generateId, - Hierarchy, - MixinData, + generateId, MixinData, Ref, TxProcessor } from '@anticrm/core' import login from '@anticrm/login' import { getMetadata, getResource, setPlatformStatus, unknownError } from '@anticrm/platform' - import presentation, { + import { Card, createQuery, EditableAvatar, @@ -271,7 +269,7 @@ const categoriesMap = new Map(Array.from(categories.map((it) => [it._id, it]))) const newSkills: TagReference[] = [] - + // Create missing tag elemnts for (const s of doc.skills ?? []) { const title = s.trim().toLowerCase() diff --git a/plugins/recruit-resources/src/components/review/EditReview.svelte b/plugins/recruit-resources/src/components/review/EditReview.svelte index ddc3dbf89a..66c6c2e394 100644 --- a/plugins/recruit-resources/src/components/review/EditReview.svelte +++ b/plugins/recruit-resources/src/components/review/EditReview.svelte @@ -17,13 +17,13 @@ import calendar from '@anticrm/calendar' import contact, { Contact } from '@anticrm/contact' import { OrganizationSelector } from '@anticrm/contact-resources' - import { getClient, UserBox, UserBoxList, UserInfo } from '@anticrm/presentation' + import { getClient, UserBox, UserBoxList } from '@anticrm/presentation' import type { Review } from '@anticrm/recruit' import { StyledTextBox } from '@anticrm/text-editor' import { Grid, Label, showPanel, StylishEdit } from '@anticrm/ui' + import view from '@anticrm/view' import { createEventDispatcher, onMount } from 'svelte' import recruit from '../../plugin' - import view from '@anticrm/view' export let object: Review @@ -80,21 +80,6 @@ }} />
- - - client.update(object, { location: object.location })} - /> -
- client.update(object, { company: object.company })} - /> -
-