diff --git a/sci-log-db/src/__tests__/unit/utils.misc.unit.ts b/sci-log-db/src/__tests__/unit/utils.misc.unit.ts index 27e2e5bb..b3473736 100644 --- a/sci-log-db/src/__tests__/unit/utils.misc.unit.ts +++ b/sci-log-db/src/__tests__/unit/utils.misc.unit.ts @@ -14,7 +14,6 @@ import { sanitizeTextContent, sanitizeTextContentInPlace, } from '../../utils/misc'; -import {matchesFilterSettings} from '../../utils/websocket'; describe('Utils unit tests', function (this: Suite) { it('Should filterEmptySubsnippets', () => { @@ -317,54 +316,4 @@ describe('Utils unit tests', function (this: Suite) { expect(t.input).to.be.eql(t.expected); }); }); - - [ - { - input: [{tags: ['a']}, {filter: {}}], - expected: true, - }, - { - input: [{tags: ['a', 'p']}, {filter: {tags: ['b', 'c']}}], - expected: false, - }, - { - input: [{snippetType: 'anotherType'}, {filter: {snippetType: ['aType']}}], - expected: false, - }, - { - input: [{snippetType: 'aType'}, {filter: {snippetType: ['aType']}}], - expected: true, - }, - { - input: [{tags: ['a', 'p']}, {filter: {tags: ['a', 'c']}}], - expected: true, - }, - { - input: [ - {tags: ['a', 'p'], snippetType: 'anotherType'}, - {filter: {tags: ['a', 'c'], snippetType: ['aType']}}, - ], - expected: false, - }, - { - input: [ - {tags: ['a', 'p'], snippetType: 'aType'}, - {filter: {tags: ['a', 'c'], snippetType: ['aType']}}, - ], - expected: true, - }, - { - input: [ - {tags: ['b', 'p'], snippetType: 'aType'}, - {filter: {tags: ['a', 'c'], snippetType: ['aType']}}, - ], - expected: false, - }, - ].forEach((t, i) => { - it(`Should test matchesFilterSettings ${i}`, () => { - expect( - matchesFilterSettings(t.input[0] as Basesnippet, t.input[1]), - ).to.be.eql(t.expected); - }); - }); }); diff --git a/sci-log-db/src/__tests__/unit/websocket.utils.ts b/sci-log-db/src/__tests__/unit/websocket.utils.ts new file mode 100644 index 00000000..d90a98a6 --- /dev/null +++ b/sci-log-db/src/__tests__/unit/websocket.utils.ts @@ -0,0 +1,56 @@ +import {expect} from '@loopback/testlab'; +import {Suite} from 'mocha'; +import {Basesnippet} from '../../models'; +import {matchesFilterSettings} from '../../utils/websocket'; + +describe('Websocket unit tests', function (this: Suite) { + [ + { + input: [{tags: ['a']}, {filter: {}}], + expected: true, + }, + { + input: [{tags: ['a', 'p']}, {filter: {tags: ['b', 'c']}}], + expected: false, + }, + { + input: [{snippetType: 'anotherType'}, {filter: {snippetType: ['aType']}}], + expected: false, + }, + { + input: [{snippetType: 'aType'}, {filter: {snippetType: ['aType']}}], + expected: true, + }, + { + input: [{tags: ['a', 'p']}, {filter: {tags: ['a', 'c']}}], + expected: true, + }, + { + input: [ + {tags: ['a', 'p'], snippetType: 'anotherType'}, + {filter: {tags: ['a', 'c'], snippetType: ['aType']}}, + ], + expected: false, + }, + { + input: [ + {tags: ['a', 'p'], snippetType: 'aType'}, + {filter: {tags: ['a', 'c'], snippetType: ['aType']}}, + ], + expected: true, + }, + { + input: [ + {tags: ['b', 'p'], snippetType: 'aType'}, + {filter: {tags: ['a', 'c'], snippetType: ['aType']}}, + ], + expected: false, + }, + ].forEach((t, i) => { + it(`Should test matchesFilterSettings ${i}`, () => { + expect( + matchesFilterSettings(t.input[0] as Basesnippet, t.input[1]), + ).to.be.eql(t.expected); + }); + }); +});