Skip to content

Commit

Permalink
Add tests for SSO JS and TS project creation
Browse files Browse the repository at this point in the history
  • Loading branch information
TCourtneyOwen committed Jan 13, 2020
1 parent 7fb1b72 commit e42682e
Showing 1 changed file with 92 additions and 1 deletion.
93 changes: 92 additions & 1 deletion src/test/convert-to-single-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('Office-Add-Taskpane-Ts projects', () => {
]
let answers = {
projectType: "taskpane",
scriptType: "TypeScript",
scriptType: "TypeScript",
name: testProjectName,
host: hosts[0]
};
Expand Down Expand Up @@ -205,3 +205,94 @@ describe('Office-Add-Taskpane-React-Ts project', () => {
});
});
});

// Test to verify converting a project to a single host
// for SSO Typescript project using Excel host
describe('Office-Add-Taskpane-SSO-TS project', () => {
const expectedFiles = [
packageJsonFile,
manifestFile,
'.ENV',
'src/taskpane/taskpane.ts',
'src/taskpane/taskpane.html',
'src/taskpane/taskpane.css',
'src/helpers/fallbackauthdialog.html',
'src/helpers/fallbackauthdialog.ts',
'src/helpers/fallbackauthhelper.ts',
'src/helpers/ssoauthhelper.ts'

]
const unexpectedFiles = [
'src/taskpane/excel.ts',
'src/taskpane/word.ts',
'src/taskpane/powerpoint.ts',
'manifest.excel.xml',
'manifest.word.xml',
'manifest.powerpoint.xml'
]
let answers = {
projectType: "single-sign-on",
scriptType: "TypeScript",
name: "SSOTypeScriptProject",
host: hosts[0]
};

describe('Office-Add-Taskpane-SSO-TS project', () => {
before((done) => {
helpers.run(path.join(__dirname, '../app')).withOptions({ 'test': true }).withPrompts(answers).on('end', done);
});

it('creates expected files', (done) => {
assert.file(expectedFiles);
assert.noFile(unexpectedFiles);
assert.noFile(unexpectedManifestFiles);
done();
});
});
});

// Test to verify converting a project to a single host
// for SSO JavaScript project using PowerPoint host
describe('Office-Add-Taskpane-SSO-JS project', () => {
const expectedFiles = [
packageJsonFile,
manifestFile,
'.ENV',
'src/taskpane/taskpane.js',
'src/taskpane/taskpane.html',
'src/taskpane/taskpane.css',
'src/helpers/documenthelper.js',
'src/helpers/fallbackauthdialog.html',
'src/helpers/fallbackauthdialog.js',
'src/helpers/fallbackauthhelper.js',
'src/helpers/ssoauthhelper.js'

]
const unexpectedFiles = [
'src/taskpane/excel.js',
'src/taskpane/word.js',
'src/taskpane/powerpoint.js',
'manifest.excel.xml',
'manifest.word.xml',
'manifest.powerpoint.xml'
]
let answers = {
projectType: "single-sign-on",
scriptType: "JavaScript",
name: "SSOJavaScriptProject",
host: hosts[3]
};

describe('Office-Add-Taskpane-SSO-JS project', () => {
before((done) => {
helpers.run(path.join(__dirname, '../app')).withOptions({ 'test': true }).withPrompts(answers).on('end', done);
});

it('creates expected files', (done) => {
assert.file(expectedFiles);
assert.noFile(unexpectedFiles);
assert.noFile(unexpectedManifestFiles);
done();
});
});
});

0 comments on commit e42682e

Please sign in to comment.