it("applies correct protein colors wrt the corresponding prop", () => { const scriptGenerator = new PyMolScriptGenerator(); const setColorStub = sinon.stub((scriptGenerator as any), "setColor"); let script: string = ""; props.proteinScheme = ProteinScheme.TRACE; props.proteinColor = ProteinColor.SECONDARY_STRUCTURE; script = scriptGenerator.generateScript("3pxe", "B", residues, props); assert.notEqual(script.indexOf("select (chain B) and (ss h);"), -1); assert.isTrue(setColorStub.withArgs("#FFA500").calledOnce, "Alpha helices should be colored with 0xFFA500 when SECONDARY_STRUCTURE is selected"); assert.notEqual(script.indexOf("select (chain B) and (ss s);"), -1); assert.isTrue(setColorStub.withArgs("#0000FF").calledOnce, "Beta sheets should be colored with 0x0000FF when SECONDARY_STRUCTURE is selected"); props.proteinScheme = ProteinScheme.CARTOON; props.proteinColor = ProteinColor.NC_RAINBOW; script = scriptGenerator.generateScript("3pxe", "B", residues, props); assert.notEqual(script.indexOf("spectrum count, rainbow_rev, sele;"), -1, "Chain should be colored with rainbow spectrum when NC_RAINBOW is selected"); props.proteinScheme = ProteinScheme.SPACE_FILLING; props.proteinColor = ProteinColor.ATOM_TYPE; script = scriptGenerator.generateScript("3pxe", "B", residues, props); assert.notEqual(script.indexOf("util.cbaw sele;"), -1, "Chain should be colored with default element colors when ATOM_TYPE is selected"); });
it('should have different ComponentType(s)', async () => { const componentType1: ComponentType = ComponentType.getFor(ComponentA) const componentType2: ComponentType = ComponentType.getFor(ComponentB) assert.equal(false, componentType1.equals(componentType2)) assert.equal(false, componentType2.equals(componentType1)) assert.notEqual(componentType1.getIndex(), componentType2.getIndex()) assert.notEqual(componentType1.getIndex(), ComponentType.getIndexFor(ComponentB)) assert.notEqual(componentType2.getIndex(), ComponentType.getIndexFor(ComponentA)) })
it('should return an array of the correct fields', () => { const fields: string[] = schema.fieldNames(); assert.equal(fields.length, 4); assert.notEqual(fields.indexOf('a'), -1); assert.notEqual(fields.indexOf('b'), -1); assert.notEqual(fields.indexOf('c'), -1); assert.notEqual(fields.indexOf('d'), -1); });
it('should return an array containing one of each datapoint corresponding to the given EncodingQuery for non-Q data', () => { const domain: string[] = domainSchema.domain({field: 'c'}); assert.isNotNull(domain); assert.equal(domain.length, 4); assert.notEqual(domain.indexOf('a'), -1); assert.notEqual(domain.indexOf('b'), -1); assert.notEqual(domain.indexOf('c'), -1); assert.notEqual(domain.indexOf('d'), -1); });
it('should have the same prototype for Class and instance', async () => { const componentA = new ComponentA() const componentB = new ComponentB() assert.equal(componentA.constructor.prototype, ComponentA.prototype) assert.equal(componentB.constructor.prototype, ComponentB.prototype) assert.notEqual(componentA.constructor.prototype, ComponentB.prototype) assert.notEqual(componentB.constructor.prototype, ComponentA.prototype) })
it("two lines", () => { const text = "hello world!."; const availableWidth = measurer.measure(text).width - 2; const baseWrapper = new Wrapper().maxLines(2); const result = wrapper.wrap(text, measurer, availableWidth); const baseResult = baseWrapper.wrap(text, measurer, availableWidth); const baseDimensions = measurer.measure(baseResult.wrappedText); const dimensions = measurer.measure(result.wrappedText); assert.deepEqual(result.originalText, text, "original text has been set"); assert.notEqual(result.wrappedText, text, "wrapped text is not the whole line"); assert.notEqual(result.wrappedText, baseResult.wrappedText, "wrapped text looks better"); assert.operator(dimensions.width, "<", baseDimensions.width, "occupies less width"); assert.equal(dimensions.height, baseDimensions.height, "occupies same height"); assert.operator(dimensions.width, "<=", availableWidth, "wrapped text fits in"); });
it ('should not copy one object twice', () => { interface INameAge { name:string; age:number; } const propertyObject:INameAge = {name: 'Foo', age: 42}; const origObject:{foo:INameAge, bar:INameAge } = { foo: propertyObject, bar: propertyObject }; const copyObject:{foo:INameAge, bar:INameAge } = object.copy(origObject, true); chai.assert.notEqual(origObject.foo, copyObject.foo); chai.assert.notEqual(origObject.bar, copyObject.bar); chai.assert.equal(copyObject.foo, copyObject.bar); });
it('should not overwrite existing gene information', () => { const mutations = [ { gene: { hugoGeneSymbol: "AR", entrezGeneId: -1 }, entrezGeneId: -1 } ]; updateMissingGeneInfo(mutations as Partial<Mutation>[], genesByHugoSymbol); assert.notEqual(mutations[0].entrezGeneId, genesByHugoSymbol["AR"].entrezGeneId); assert.notEqual(mutations[0].gene.entrezGeneId, genesByHugoSymbol["AR"].entrezGeneId); });
export const schemaLookup = async (data = dataSchemaLookup()) => { const schema = await Schema.lookup(data) assert.notEqual(schema.handle, undefined) assert.equal(schema.sourceId, data.sourceId) assert.ok(schema.schemaId) return schema }
it("applies correct protein style wrt the corresponding prop", () => { const scriptGenerator = new PyMolScriptGenerator(); let script: string = ""; props.proteinScheme = ProteinScheme.TRACE; script = scriptGenerator.generateScript("3pxe", "B", residues, props); assert.notEqual(script.indexOf("hide everything; show ribbon;"), -1); props.proteinScheme = ProteinScheme.SPACE_FILLING; script = scriptGenerator.generateScript("3pxe", "B", residues, props); assert.notEqual(script.indexOf("hide everything; show spheres;"), -1); props.proteinScheme = ProteinScheme.CARTOON; script = scriptGenerator.generateScript("3pxe", "B", residues, props); assert.notEqual(script.indexOf("hide everything; show cartoon;"), -1); });