Skip to content

Commit d4895ec

Browse files
committed
Delete test schema once test is done
Signed-off-by: Seb Julliand <[email protected]>
1 parent 1584507 commit d4895ec

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

src/api/tests/suites/content.test.ts

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -622,23 +622,26 @@ describe('Content Tests', { concurrent: true }, () => {
622622
const shortName = Tools.makeid(8);
623623
const createLib = await connection.runCommand({ command: `RUNSQL 'create schema "${longName}" for ${shortName}' commit(*none)`, noLibList: true });
624624
if (createLib.code === 0) {
625-
const result = await connection.runCommand({ command: `CRTSRCPF FILE(${shortName}/SFILE) MBR(MBR) TEXT('Test long library name')` });
626-
627-
const libraries = await content.getLibraries({ library: `${shortName}` });
628-
expect(libraries?.length).toBe(1);
625+
try {
626+
await connection.runCommand({ command: `CRTSRCPF FILE(${shortName}/SFILE) MBR(MBR) TEXT('Test long library name')` });
629627

630-
const objects = await content.getObjectList({ library: `${shortName}`, types: [`*SRCPF`], object: `SFILE` });
631-
expect(objects?.length).toBe(1);
632-
expect(objects[0].type).toBe(`*FILE`);
633-
expect(objects[0].text).toBe(`Test long library name`);
628+
const libraries = await content.getLibraries({ library: `${shortName}` });
629+
expect(libraries?.length).toBe(1);
634630

635-
const memberCount = await content.countMembers({ library: `${shortName}`, name: `SFILE` });
636-
expect(memberCount).toBe(1);
637-
const members = await content.getMemberList({ library: `${shortName}`, sourceFile: `SFILE` });
631+
const objects = await content.getObjectList({ library: `${shortName}`, types: [`*SRCPF`], object: `SFILE` });
632+
expect(objects?.length).toBe(1);
633+
expect(objects[0].type).toBe(`*FILE`);
634+
expect(objects[0].text).toBe(`Test long library name`);
638635

639-
expect(members?.length).toBe(1);
636+
const memberCount = await content.countMembers({ library: `${shortName}`, name: `SFILE` });
637+
expect(memberCount).toBe(1);
638+
const members = await content.getMemberList({ library: `${shortName}`, sourceFile: `SFILE` });
640639

641-
await connection.runCommand({ command: `RUNSQL 'drop schema "${longName}"' commit(*none)`, noLibList: true });
640+
expect(members?.length).toBe(1);
641+
}
642+
finally {
643+
await connection.runCommand({ command: `RUNSQL 'drop schema "${longName}"' commit(*none)`, noLibList: true });
644+
}
642645
} else {
643646
throw new Error(`Failed to create schema "${longName}"`);
644647
}
@@ -737,7 +740,7 @@ describe('Content Tests', { concurrent: true }, () => {
737740
await connection.sendCommand({ command: `${connection.remoteFeatures.attr} ${directory}/${ccsid37File} CCSID=37` });
738741
await checkFile(`${directory}/${ccsid37File}`, 37);
739742
const files = [`${directory}/${unicodeFile}`, `${directory}/${ccsid37File}`];
740-
743+
741744
expect((await connection.sendCommand({ command: `mkdir ${directory}/copy` })).code).toBe(0);
742745
expect((await content.copy(files, `${directory}/copy`)).code).toBe(0);
743746
expect(await content.testStreamFile(`${directory}/${unicodeFile}`, "f")).toBe(true);

0 commit comments

Comments
 (0)