Page MenuHomec4science

basic_datatype.spec.ts
No OneTemporary

File Metadata

Created
Sat, Aug 3, 00:56

basic_datatype.spec.ts

import { Component, Input, DebugElement, NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { BasicResultBindingElement, FusekiResults} from './basic_datatype';
const data = {'iri': 'asdf'};
const validData: FusekiResults = { 'head': { 'vars': [ 'id' ] }, 'results': { 'bindings': null }}
class A {
class: string = 'A';
static do<T extends typeof A>(this: T): InstanceType<T> {
return new this() as InstanceType<T>;
}
}
class B extends A {
class: string = 'B';
}
describe('BasicResultBindingElement', () => {
it('should create the Object', ()=>{
expect(new BasicResultBindingElement(data)).toBeTruthy();
});
it('should return its query if there is not input', ()=>{
expect(BasicResultBindingElement.getQuery()).toEqual(`SELECT ?id ?p ?o WHERE { ?id ?p ?o. }`);
});
it('should return a subject changed query', ()=>{
expect(BasicResultBindingElement.getQuery('http://example.com#test')).toEqual(`SELECT ?id ?p ?o WHERE { <http://example.com#test> ?p ?o. }`);
});
it('should return a object changed query', ()=>{
expect(BasicResultBindingElement.getQuery('http://example.com#test', 'o')).toEqual(`SELECT ?id ?p ?o WHERE { ?id ?p <http://example.com#test>. }`);
});
it('should return a predicate changed query', ()=>{
expect(BasicResultBindingElement.getQuery('http://example.com#test', 'p')).toEqual(`SELECT ?id ?p ?o WHERE { ?id <http://example.com#test> ?o. }`);
});
it('should return subclass', ()=>{
expect(B.do().class == "B").toBeTruthy();
});
});

Event Timeline