engine_web-ifc icon indicating copy to clipboard operation
engine_web-ifc copied to clipboard

Automated Test Suite #110

Open TxTony opened this issue 3 years ago • 2 comments

Commands :

  • npm run test:unit
  • npm run test:functional
  • npm run test

Output from console

image

TxTony avatar Oct 15 '22 09:10 TxTony

Which line... this bit?

storey.LongName.value = newStoreyName;
ifcApi.WriteLine(modelId, storey);
storey = await ifcApi.properties.getItemProperties(modelId, storeyId);
expect(storey.LongName.value).toBe(newStoreyName);

I think the caller's perspective is that writing the value to tape shouldn't affect the local property's value, and should also be equal after round-tripping.

That's what I didn't see asserted in your tests, but yeah, maybe we're missing each other's perspective :)

On Mon, Oct 17, 2022 at 2:20 AM TxTony @.***> wrote:

@.**** commented on this pull request.

In tests/functional/WebIfcApi.spec.ts https://github.com/IFCjs/web-ifc/pull/233#discussion_r996691765:

  •        CompositionType: undefined,
    
  •        PredefinedType: undefined,
    
  •        ElevationWithFlooring: undefined
    
  •    }
    
  •    ifcApi.WriteLine(modelID, payload);
    
  •    let projectAfterWriting: any = ifcApi.GetAllLines(modelID);
    
  •    expect(projectBeforeWriting.size() + 1).toEqual(projectAfterWriting.size());
    
  • })
  • test('can modify a line by giving a line object', () => {
  •    let aSpace: any = ifcApi.GetLine(modelID, expressId);
    
  •    aSpace.Name.value = "foo";
    
  •    ifcApi.WriteLine(modelID, aSpace);
    
  •    let aSpaceReloaded: any = ifcApi.GetLine(modelID, expressId);
    
  •    expect(aSpaceReloaded.Name.value).toEqual("foo");
    
  • })
  • test('can Export File As IFC', () => {

Hi Pablo, All the methods are already tested so you can use them in any way. A WriteFile on web-ifc 0.0.36 fails so any scenario depending on writeFile will fail with this version. I don't think it is necessary at this point to make complexe scenario, except for documentation :) and documentation with test is the smart way.

However something is interresting with your test your tring to writeFile on a getItemProperties() result.

Maybe i am missing something what do you think ?

— Reply to this email directly, view it on GitHub https://github.com/IFCjs/web-ifc/pull/233#discussion_r996691765, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS5V3ZBHOINYWFLVMGXGH3WDT45DANCNFSM6AAAAAARF2TYDY . You are receiving this because you commented.Message ID: @.***>

-- interweb homepage http://sites.google.com/site/pablomayrgundter

pablo-mayrgundter avatar Oct 17 '22 15:10 pablo-mayrgundter

Which line... this bit? storey.LongName.value = newStoreyName; ifcApi.WriteLine(modelId, storey); storey = await ifcApi.properties.getItemProperties(modelId, storeyId); expect(storey.LongName.value).toBe(newStoreyName); I think the caller's perspective is that writing the value to tape shouldn't affect the local property's value, and should also be equal after round-tripping. That's what I didn't see asserted in your tests, but yeah, maybe we're missing each other's perspective :) On Mon, Oct 17, 2022 at 2:20 AM TxTony @.> wrote: @.* commented on this pull request. ------------------------------ In tests/functional/WebIfcApi.spec.ts <#233 (comment)>: > + CompositionType: undefined, + PredefinedType: undefined, + ElevationWithFlooring: undefined + } + ifcApi.WriteLine(modelID, payload); + let projectAfterWriting: any = ifcApi.GetAllLines(modelID); + expect(projectBeforeWriting.size() + 1).toEqual(projectAfterWriting.size()); + }) + test('can modify a line by giving a line object', () => { + let aSpace: any = ifcApi.GetLine(modelID, expressId); + aSpace.Name.value = "foo"; + ifcApi.WriteLine(modelID, aSpace); + let aSpaceReloaded: any = ifcApi.GetLine(modelID, expressId); + expect(aSpaceReloaded.Name.value).toEqual("foo"); + }) + test('can Export File As IFC', () => { Hi Pablo, All the methods are already tested so you can use them in any way. A WriteFile on web-ifc 0.0.36 fails so any scenario depending on writeFile will fail with this version. I don't think it is necessary at this point to make complexe scenario, except for documentation :) and documentation with test is the smart way. However something is interresting with your test your tring to writeFile on a getItemProperties() result. Maybe i am missing something what do you think ? — Reply to this email directly, view it on GitHub <#233 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS5V3ZBHOINYWFLVMGXGH3WDT45DANCNFSM6AAAAAARF2TYDY . You are receiving this because you commented.Message ID: @.***> -- interweb homepage http://sites.google.com/site/pablomayrgundter

Ok i Can add your test. I'll do it After @agviegas valid this PR ( or not ;) )

TxTony avatar Oct 17 '22 17:10 TxTony

Hey, there are some conflicts. Solve them and I'll merge! Thanks 🙂

agviegas avatar Oct 20 '22 19:10 agviegas

Tony go ahead and submit without my test. I can add it later

pablo-mayrgundter avatar Oct 20 '22 19:10 pablo-mayrgundter

okay @agviegas it is done, i have add pablo's test case.

TxTony avatar Oct 21 '22 13:10 TxTony

Looks good to me!

pablo-mayrgundter avatar Oct 26 '22 14:10 pablo-mayrgundter