Skip to content

Commit

Permalink
test(edition): update tests after ng-bootstrap update
Browse files Browse the repository at this point in the history
  • Loading branch information
musicEnfanthen committed Dec 23, 2024
1 parent 1519c8a commit 31d66c0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -906,11 +906,11 @@ describe('ConstructResultsComponent (DONE)', () => {
});

it('... should be triggered from ngbAccordionBody', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult[0]);
});

it('... should be triggered by change of queryResult', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult[0]);

// Mock another queryResult
const anotherQueryResult = {
Expand All @@ -921,24 +921,24 @@ describe('ConstructResultsComponent (DONE)', () => {
component.queryResult$ = observableOf([anotherQueryResult]);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, anotherQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 4, anotherQueryResult[0]);
});

describe('... should return false if ...', () => {
it('... queryResult is empty array', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult[0]);

// Mock empty response
const emptyQueryResult = [];
component.queryResult$ = observableOf(emptyQueryResult);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, emptyQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 4, emptyQueryResult);
expectToBe(component.isQueryResultNotEmpty(emptyQueryResult), false);
});

it('... queryResult.subject is undefined or empty string', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult[0]);

// Mock undefined response
const undefinedQueryResult = {
Expand All @@ -949,7 +949,7 @@ describe('ConstructResultsComponent (DONE)', () => {
component.queryResult$ = observableOf([undefinedQueryResult]);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, undefinedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 4, undefinedQueryResult[0]);
expectToBe(component.isQueryResultNotEmpty([undefinedQueryResult]), false);

// Mock empty response
Expand All @@ -961,12 +961,12 @@ describe('ConstructResultsComponent (DONE)', () => {
component.queryResult$ = observableOf([emptyQueryResult]);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 5, emptyQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 6, emptyQueryResult[0]);
expectToBe(component.isQueryResultNotEmpty([emptyQueryResult]), false);
});

it('... queryResult.predicate is undefined or empty string', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult[0]);

// Mock undefined response
const undefinedQueryResult = {
Expand All @@ -977,7 +977,7 @@ describe('ConstructResultsComponent (DONE)', () => {
component.queryResult$ = observableOf([undefinedQueryResult]);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, undefinedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 4, undefinedQueryResult[0]);
expectToBe(component.isQueryResultNotEmpty([undefinedQueryResult]), false);

// Mock empty response
Expand All @@ -989,12 +989,12 @@ describe('ConstructResultsComponent (DONE)', () => {
component.queryResult$ = observableOf([emptyQueryResult]);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 5, emptyQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 6, emptyQueryResult[0]);
expectToBe(component.isQueryResultNotEmpty([emptyQueryResult]), false);
});

it('... queryResult.object is undefined or empty string', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult[0]);

// Mock undefined response
const undefinedQueryResult = {
Expand All @@ -1005,7 +1005,7 @@ describe('ConstructResultsComponent (DONE)', () => {
component.queryResult$ = observableOf([undefinedQueryResult]);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, undefinedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 4, undefinedQueryResult[0]);
expectToBe(component.isQueryResultNotEmpty([undefinedQueryResult]), false);

// Mock empty response
Expand All @@ -1017,33 +1017,33 @@ describe('ConstructResultsComponent (DONE)', () => {
component.queryResult$ = observableOf([emptyQueryResult]);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 5, emptyQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 6, emptyQueryResult[0]);
expectToBe(component.isQueryResultNotEmpty([emptyQueryResult]), false);
});

it('... queryResult.subject, queryResult.predicate and queryResult.object are undefined or empty string', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult[0]);

// Mock undefined response
const undefinedQueryResult = { subject: undefined, predicate: undefined, object: undefined };
component.queryResult$ = observableOf([undefinedQueryResult]);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, undefinedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 4, undefinedQueryResult[0]);
expectToBe(component.isQueryResultNotEmpty([undefinedQueryResult]), false);

// Mock empty response
const emptyQueryResult = { subject: '', predicate: '', object: '' };
component.queryResult$ = observableOf([emptyQueryResult]);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 5, emptyQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 6, emptyQueryResult[0]);
expectToBe(component.isQueryResultNotEmpty([emptyQueryResult]), false);
});
});

it('... should return true if queryResult is not empty', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult[0]);

// Mock non-empty response
const nonEmptyQueryResult = {
Expand All @@ -1054,7 +1054,7 @@ describe('ConstructResultsComponent (DONE)', () => {
component.queryResult$ = observableOf([nonEmptyQueryResult]);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, nonEmptyQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 4, nonEmptyQueryResult[0]);
expectToBe(component.isQueryResultNotEmpty([nonEmptyQueryResult]), true);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,11 @@ describe('SelectResultsComponent (DONE)', () => {
});

it('... should be triggered from ngbAccordionBody', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult[0]);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult[0]);
});

it('... should be triggered by change of queryResult', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult);

// Mock another queryResult
const queryResult = {
Expand All @@ -683,88 +683,88 @@ describe('SelectResultsComponent (DONE)', () => {

detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, queryResult);
expectSpyCall(isQueryResultNotEmptySpy, 4, queryResult);
});

describe('... should return false if ...', () => {
it('... queryResult.head is undefined', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult);

// Mock undefined response
const undefinedQueryResult = { head: undefined, body: { bindings: [{ test: 'Test' }] } };
component.queryResult$ = observableOf(undefinedQueryResult);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, undefinedQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 4, undefinedQueryResult);
expectToBe(component.isQueryResultNotEmpty(undefinedQueryResult), false);
});

it('... queryResult.body is undefined', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult);

// Mock undefined response
const undefinedQueryResult = { head: { vars: ['Test'] }, body: undefined };
component.queryResult$ = observableOf(undefinedQueryResult);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, undefinedQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 4, undefinedQueryResult);
expectToBe(component.isQueryResultNotEmpty(undefinedQueryResult), false);
});

it('... queryResult.head and queryResult.body are undefined', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult);

// Mock undefined response
const undefinedQueryResult = { head: undefined, body: undefined };
component.queryResult$ = observableOf(undefinedQueryResult);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, undefinedQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 4, undefinedQueryResult);
expectToBe(component.isQueryResultNotEmpty(undefinedQueryResult), false);
});

it('... queryResult.head.vars is empty array', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult);

// Mock empty response
const emptyQueryResult = { head: { vars: [] }, body: { bindings: [{ testKey: 'TestValue' }] } };
component.queryResult$ = observableOf(emptyQueryResult);

detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, emptyQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 4, emptyQueryResult);
expectToBe(component.isQueryResultNotEmpty(emptyQueryResult), false);
});

it('... queryResult.body.bindings is empty array', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult);

// Mock empty response
const emptyQueryResult = { head: { vars: ['TestHeader'] }, body: { bindings: [] } };
component.queryResult$ = observableOf(emptyQueryResult);

detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, emptyQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 4, emptyQueryResult);
expectToBe(component.isQueryResultNotEmpty(emptyQueryResult), false);
});

it('... queryResult.head.vars & queryResult.body.bindings are empty arrays', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult);

// Mock empty response
const emptyQueryResult = { head: { vars: [] }, body: { bindings: [] } };
component.queryResult$ = observableOf(emptyQueryResult);

detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, emptyQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 4, emptyQueryResult);
expectToBe(component.isQueryResultNotEmpty(emptyQueryResult), false);
});
});

it('... should return true if queryResult.head.vars && queryResult.body.bindings is not empty (length > 0)', () => {
expectSpyCall(isQueryResultNotEmptySpy, 2, expectedQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 3, expectedQueryResult);

// Mock non-empty response
const nonEmptyQueryResult = {
Expand All @@ -774,7 +774,7 @@ describe('SelectResultsComponent (DONE)', () => {
component.queryResult$ = observableOf(nonEmptyQueryResult);
detectChangesOnPush(fixture);

expectSpyCall(isQueryResultNotEmptySpy, 3, nonEmptyQueryResult);
expectSpyCall(isQueryResultNotEmptySpy, 4, nonEmptyQueryResult);
expectToBe(component.isQueryResultNotEmpty(nonEmptyQueryResult), true);
});
});
Expand Down

0 comments on commit 31d66c0

Please sign in to comment.