1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { getAdvancedDataFromQuery, getQueryFromAdvancedData } from "~/store/search-bar/search-bar-actions";
6 import { ResourceKind } from "~/models/resource";
8 describe('search-bar-actions', () => {
9 describe('getAdvancedDataFromQuery', () => {
10 it('should correctly build advanced data record from query #1', () => {
11 const r = getAdvancedDataFromQuery('val0 has:"file size":"100mb" val2 has:"user":"daniel" is:starred val2 val0 is:trashed');
13 searchValue: 'val0 val2',
16 projectUuid: undefined,
32 it('should correctly build advanced data record from query #2', () => {
33 const r = getAdvancedDataFromQuery('document from:2017-08-01 pdf has:"filesize":"101mb" is:trashed type:arvados#collection cluster:c97qx');
35 searchValue: 'document pdf',
36 type: ResourceKind.COLLECTION,
38 projectUuid: undefined,
40 dateFrom: '2017-08-01',
52 describe('getQueryFromAdvancedData', () => {
53 it('should build query from advanced data', () => {
54 const q = getQueryFromAdvancedData({
55 searchValue: 'document pdf',
56 type: ResourceKind.COLLECTION,
58 projectUuid: undefined,
60 dateFrom: '2017-08-01',
69 expect(q).toBe('document pdf type:arvados#collection cluster:c97qx is:trashed from:2017-08-01 has:"file size":"101mb"');