-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
281 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import ImdiGenerator, { IMDIMode } from "./ImdiGenerator"; | ||
import { Project } from "../model/Project/Project"; | ||
import { | ||
setResultXml, | ||
xexpect as expect, | ||
count, | ||
value, | ||
xexpect | ||
} from "../other/xmlUnitTestUtils"; | ||
import temp from "temp"; | ||
import * as fs from "fs-extra"; | ||
import assert from "assert"; | ||
import { | ||
describe, | ||
it, | ||
vi, | ||
beforeAll, | ||
afterAll, | ||
test, | ||
afterEach, | ||
beforeEach | ||
} from "vitest"; | ||
import { GetProjectFileWithOneField } from "../model/Project/WriteProject.spec"; | ||
|
||
temp.track(); // cleanup on exit: doesn't work | ||
|
||
let project: Project; | ||
let projectDir: string; | ||
|
||
describe("Imdi generation for images", () => { | ||
beforeEach(() => { | ||
projectDir = temp.mkdirSync("lameta imdi actor generator test"); | ||
project = Project.fromDirectory(projectDir); | ||
}); | ||
|
||
afterEach(() => { | ||
fs.emptyDirSync(projectDir); | ||
fs.removeSync(projectDir); | ||
}); | ||
|
||
test("fundingProjectTitle goes to the right place", () => { | ||
// NB: in ELAR, at least, this will appear as "Collection Title" | ||
project.properties.setText("fundingProjectTitle", "my title"); | ||
project.properties.setText("projectDescription", "my description"); | ||
project.properties.setText("collectionSteward", "my steward"); | ||
const x = ImdiGenerator.generateCorpus( | ||
IMDIMode.RAW_IMDI, | ||
project, | ||
[], | ||
true | ||
); | ||
|
||
setResultXml(x); | ||
|
||
// From Hanna: Collection Title = Corpus/Title | ||
// From Hanna: Collection Key = Corpus/MDGroup/Keys/Key[@Name='CorpusId'] | ||
// The ELAR fields.json renames the label for fundingProjectTitle to "Collection Title" | ||
expect("//Corpus/Title").toMatch("my title"); | ||
|
||
// From Hanna: Collection Description= Corpus/Description[@Name='short_description'] | ||
// The ELAR fields.json renames the label for projectDescription to "Collection Description" | ||
expect('//Corpus/Description[@Name="short_description"]').toMatch( | ||
"my description" | ||
); | ||
// From Hanna: Collection Steward = Corpus/MDGroup/Actors/Actor[@Role='Collection Steward'] | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export type OtherConfigurationSettings = { | ||
configurationFullName: string; | ||
showImdiPreview: boolean; | ||
showParadisec: boolean; | ||
fileNameRules: "ASCII" | "unicode"; | ||
}; | ||
|
||
let otherConfigurationSettings: OtherConfigurationSettings = { | ||
configurationFullName: "", | ||
showImdiPreview: false, | ||
showParadisec: false, | ||
fileNameRules: "ASCII" | ||
}; | ||
|
||
export function SetOtherConfigurationSettings( | ||
settings: OtherConfigurationSettings | ||
) { | ||
otherConfigurationSettings = settings; | ||
} | ||
export function GetOtherConfigurationSettings(): OtherConfigurationSettings { | ||
return otherConfigurationSettings; | ||
} | ||
export function resetOtherConfigurationSettings() { | ||
otherConfigurationSettings = { | ||
showImdiPreview: false, | ||
showParadisec: false, | ||
configurationFullName: "", | ||
fileNameRules: "ASCII" | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.