TestUtil

TestUtil

TestUtil contains a number of static utility functions used in testing.

Constructor

new TestUtil()

Source:

Members

(static) ISODatePattern

This regexp matches the general ISO 8601 datetime format.

Source:

Methods

(static) deleteJsonFile()

Delete the JSON files where unit tests store PersistentObjects. We don't want stored data from one test to persist into the next test.

Source:

(static) loadFixtures(filenames, type, save) → {Array.<object>}

This loads fixtures from the test/fixtures directory and optionally saves them. It returns an array of the objects it loaded.

Parameters:
Name Type Default Description
filenames string | Array.<string>

A string or array of strings speficying which files to load. These should be the names of files inside the test/fixtures directory, minus the .json file extension. For example, "Job_001" or ["Job_001", "Job_002", "Job_003"].

type PersistentObject | JobParams

The type of object to load. This should be one of the following:

  • AppSetting
  • InternalSetting
  • Job
  • JobParams
  • RemoteRepository
  • StorageService
  • Workflow
save boolean false

If true, this saves the fixtures into the DART database before returning them. Default is false.

Source:

(static) loadFromProfilesDir(filename) → {BagItProfile}

This loads a BagItProfile from the profiles directory.

Parameters:
Name Type Description
filename string

The file name of the BagIt profile to load. For example, "my_profile.json".

Source:

(static) loadProfile(filename) → {BagItProfile}

This loads a BagItProfile from the test/profiles directory.

Parameters:
Name Type Description
filename string

The file name of the BagIt profile to load. For example, "my_profile.json".

Source: