Skip to content

Commit

Permalink
Add test for long library names
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjorgensen committed Nov 1, 2024
1 parent 171da23 commit feaeeae
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/testing/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,36 @@ export const ContentSuite: TestSuite = {
}
}
}
},
{
name: `Test long library name`, test: async () => {
const connection = instance.getConnection()!;
const content = instance.getContent()!;
const longName = Tools.makeid(18);
const shortName = Tools.makeid(8);
const createLib = await connection.runCommand({ command: `RUNSQL 'create schema "${longName}" for ${shortName}' commit(*none)`, noLibList: true });
if (createLib.code === 0) {
await connection!.runCommand({ command: `CRTSRCPF FILE(${shortName}/SFILE) MBR(MBR) TEXT('Test long library name')` });

const libraries = await content?.getLibraries({ library: `${shortName}` })
assert.strictEqual(libraries?.length, 1);

const objects = await content?.getObjectList({ library: `${shortName}`, types: [`*SRCPF`], object: `SFILE` });
assert.strictEqual(objects?.length, 1);
assert.strictEqual(objects[0].type, `*FILE`);
assert.strictEqual(objects[0].text, `Test long library name`);

const memberCount = await content.countMembers({ library: `${shortName}`, name: `SFILE` });
assert.strictEqual(memberCount, 1);
const members = await content?.getMemberList({ library: `${shortName}`, sourceFile: `SFILE` });

assert.strictEqual(members?.length, 1);

await connection.runCommand({ command: `RUNSQL 'drop schema "${longName}"' commit(*none)`, noLibList: true });
} else {
throw new Error(`Failed to create schema "${longName}"`);
}
}
}
]
};

0 comments on commit feaeeae

Please sign in to comment.