Skip to content
This repository was archived by the owner on Jan 4, 2022. It is now read-only.
This repository was archived by the owner on Jan 4, 2022. It is now read-only.

Some tests need updating (Document.spec.js) #345

@HashEngineering

Description

@HashEngineering

Expected Behavior

Tests should reflect current Document class.

This test is working with ownerId instead of dataContractId.

  describe('#getDataContractId', () => {
    it('should return $dataContractId', () => {
      expect(document.getOwnerId()).to.deep.equal(rawDocument.$ownerId);
    });
  });

This test is working with the obsolete Document.action:

  it('should create Document with undefined action and data if present', () => {
      const data = {
        test: 1,
      };

      rawDocument = {
        $type: 'test',
        ...data,
      };

      document = new Document(rawDocument, dataContract);

      expect(document.action).to.equal(undefined);
      expect(Document.prototype.setData).to.have.been.calledOnceWith(data);
    });

Current Behavior

Presumably tests pass.

Possible Solution

Use dataContractId instead of ownerId in this test.

  describe('#getDataContractId', () => {
    it('should return $dataContractId', () => {
      expect(document.getDataContractId()).to.deep.equal(rawDocument.$dataContractId);
    });
  });
 

Remove this test:
'should create Document with undefined action and data if present'

Steps to Reproduce (for bugs)

No tests were actually run. This is from static code analysis.

Context

I am looking at these unit tests to see what can be applied to the Android DPP library.

Your Environment

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions