jec-sandcat
Version:
JEC Sandcat - The default RESTful web services framework for GlassCat applications.
112 lines (99 loc) • 3.5 kB
text/typescript
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
//
// Copyright 2016-2018 Pascal ECHEMANN.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { TestSuite, Test, TestSorters, BeforeAll, AfterAll } from "jec-juta";
import { expect } from "chai";
import { ResourceDescriptorRegistry } from "../../../../../src/com/onsoft/sandcat/metadata/ResourceDescriptorRegistry";
import { ResourceDescriptor } from "../../../../../src/com/onsoft/sandcat/reflect/ResourceDescriptor";
import { ParameterDescriptor } from "../../../../../src/com/onsoft/sandcat/reflect/ParameterDescriptor";
export class ResourceDescriptorRegistryTest {
public descriptor:ResourceDescriptor = null;
public initTest():void {
this.descriptor = new ResourceDescriptor();
}
public resetTest():void {
this.descriptor = null;
}
public getRegisteredDescriptorDefaultTest():void {
expect(ResourceDescriptorRegistry.getRegisteredDescriptor()).to.be.null;
}
public getParametersMapDefaultTest():void {
expect(ResourceDescriptorRegistry.getParametersMap()).to.be.null;
}
public registerDescriptorTest():void {
expect(
ResourceDescriptorRegistry.registerDescriptor(this.descriptor)
).to.be.undefined;
}
public getRegisteredDescriptorTest():void {
expect(
ResourceDescriptorRegistry.getRegisteredDescriptor()
).to.equal(this.descriptor);
}
public getParametersMapTest():void {
const map:Map<string, Array<ParameterDescriptor>> =
ResourceDescriptorRegistry.getParametersMap();
expect(map.size).to.equal(0);
}
public resetDescriptorTest():void {
expect(
ResourceDescriptorRegistry.registerDescriptor(null)
).to.be.undefined;
}
public getRegisteredDescriptorResetTest():void {
expect(ResourceDescriptorRegistry.getRegisteredDescriptor()).to.be.null;
}
public getParametersMapResetTest():void {
expect(ResourceDescriptorRegistry.getParametersMap()).to.be.null;
}
}