Skip to content

Commit

Permalink
Update tests for 2021
Browse files Browse the repository at this point in the history
Some tests are currently failing because they are
reading the current year and comparing it against
"2020".
This change updates the tests to expect "2021" instead.
Furthermore, inconsistenct in casing is causing issues
in other tests.

This change takes care of both issues.
  • Loading branch information
HKrausAxon committed Mar 16, 2021
1 parent 4bfb056 commit cb1b778
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions __tests__/creator-spec.ts
Expand Up @@ -80,7 +80,8 @@ const testIncludesBase = (title: string, expectation: boolean , ...content: Arra
// We want to be able to search across line breaks and multiple spaces.
const singleLineWxContent = wxsContent.replace(/\s\s+/g, ' ');
content.forEach((innerContent) => {
expect(singleLineWxContent.includes(innerContent)).toBe(expectation);
if (expectation) expect(singleLineWxContent).toContain(innerContent);
else expect(singleLineWxContent).not.toContain(innerContent);
});
}
});
Expand Down Expand Up @@ -142,7 +143,7 @@ testIncludes('an APPLICATIONROOTDIRECTORY', '<Directory Id="APPLICATIONROOTDIREC

testIncludes('an ApplicationProgramsFolder', '<Directory Id="ApplicationProgramsFolder"');

testIncludes('a default appUserModelId', 'Key="System.AppUserModel.ID" Value="com.squirrel.Acme.acme"');
testIncludes('a default appUserModelId', 'Key="System.AppUserModel.ID" Value="com.squirrel.acme.acme"');

regexTestIncludes('versioned app folder', /<Directory\s*Id=".*"\s*Name="app-1\.0\.0"/);

Expand Down Expand Up @@ -515,7 +516,7 @@ describe('auto-launch', () => {
});

testIncludes('RegistryRunKey', '<RegistryKey Root="HKMU" Key="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run" ForceCreateOnInstall="no" ForceDeleteOnUninstall="no"');
testIncludes('RegistryRunKeyValue', '<RegistryValue Name="com.squirrel.Acme.acme" Type="string" Value="&quot;[APPLICATIONROOTDIRECTORY]acme.exe&quot;" KeyPath="yes"/>');
testIncludes('RegistryRunKeyValue', '<RegistryValue Name="com.squirrel.acme.acme" Type="string" Value="&quot;[APPLICATIONROOTDIRECTORY]acme.exe&quot;" KeyPath="yes"/>');
testIncludes('RegistryRunKey component', '<Component Id="RegistryRunKey"');
testIncludes('RegistryRunKey component-ref', '<ComponentRef Id="RegistryRunKey" />');
regexTestIncludes('AutoLaunch feature', /<Feature Id="AutoLaunch" Title="Launch On Login" Level="2" .*>/);
Expand All @@ -530,7 +531,7 @@ describe('auto-launch', () => {
expect(wxsFile).toBeTruthy();
});

testIncludes('RegistryRunKey', '<RegistryValue Name="com.squirrel.Acme.acme" Type="string" Value="&quot;[APPLICATIONROOTDIRECTORY]acme.exe&quot; arg1 arg2" KeyPath="yes"/>');
testIncludes('RegistryRunKey', '<RegistryValue Name="com.squirrel.acme.acme" Type="string" Value="&quot;[APPLICATIONROOTDIRECTORY]acme.exe&quot; arg1 arg2" KeyPath="yes"/>');

});

Expand Down
12 changes: 6 additions & 6 deletions __tests__/utils/rc-edit-spec.ts
Expand Up @@ -19,7 +19,7 @@ const acmeExeRegex = process.platform === 'win32' ? /C:\\tmp\\acme.*\\acme\.exe/
const acmeFileInfo = { 'version-string':
{ CompanyName: 'acme corp',
FileDescription: 'a test',
LegalCopyright: '2020@acme corp',
LegalCopyright: '2021@acme corp',
ProductName: 'acme' },
'file-version': '1.2.3',
'product-version': '1.2.3',
Expand Down Expand Up @@ -51,7 +51,7 @@ test('transfers exe file info to stub exe', async () => {
callback(null, {
CompanyName: 'acme corp',
FileDescription: 'a test',
LegalCopyright: '2020@acme corp',
LegalCopyright: '2021@acme corp',
ProductName: 'acme',
FileVersion: '1.2.3',
ProductVersion: '1.2.3'
Expand All @@ -74,7 +74,7 @@ test('uses parameter if rcinfo fails', async () => {
const wayneOptions = { 'version-string':
{ CompanyName: 'Wayne Enterprise',
FileDescription: 'I am Batman',
LegalCopyright: '2020@Wayne Enterprise',
LegalCopyright: '2021@Wayne Enterprise',
ProductName: 'bat-app' },
'file-version': '3.3.3',
'product-version': '3.3.3',
Expand All @@ -93,7 +93,7 @@ test('uses an explicitly provided app icon for the stub exe', async () => {
callback(null, {
CompanyName: 'acme corp',
FileDescription: 'a test',
LegalCopyright: '2020@acme corp',
LegalCopyright: '2021@acme corp',
ProductName: 'acme',
FileVersion: '1.2.3',
ProductVersion: '1.2.3'
Expand All @@ -115,7 +115,7 @@ test('it users no icon if extraction fails and no explicit one is provided', asy
callback(null, {
CompanyName: 'acme corp',
FileDescription: 'a test',
LegalCopyright: '2020@acme corp',
LegalCopyright: '2021@acme corp',
ProductName: 'acme',
FileVersion: '1.2.3',
ProductVersion: '1.2.3'
Expand All @@ -141,7 +141,7 @@ test('it users no icon if icon extractor module is not available', async () => {
callback(null, {
CompanyName: 'acme corp',
FileDescription: 'a test',
LegalCopyright: '2020@acme corp',
LegalCopyright: '2021@acme corp',
ProductName: 'acme',
FileVersion: '1.2.3',
ProductVersion: '1.2.3'
Expand Down

0 comments on commit cb1b778

Please sign in to comment.