Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion __tests__/command_helpers/appendSolidaritySettings.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import appendSolidaritySettings from '../../src/extensions/functions/appendSolidaritySettings'
import { keys } from 'ramda'
import solidarityExtension from '../../src/extensions/solidarity-extension'
import { solidarity } from '../../src/types'

const context = require('mockContext')

Expand Down
2 changes: 1 addition & 1 deletion __tests__/command_helpers/checkCLIForUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('checkCLIForUpdates', () => {
rule.binary = 'yarn'
context.print = {
colors: {
green: jest.fn(string => string),
green: jest.fn(stringy => stringy),
},
}
})
Expand Down
1 change: 0 additions & 1 deletion __tests__/command_helpers/checkENV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ test('checkENV detects set ENV', async () => {
}
// Use checkENV to make sure it exists
expect(await checkENV({ variable: someRealEnvVar })).toBeTruthy()
} else {
}
})

Expand Down
3 changes: 1 addition & 2 deletions __tests__/command_helpers/checkRequirement.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { SolidarityRequirement } from '../../dist/types'
import { toPairs } from 'ramda'
import { strings } from 'gluegun/toolbox'

Expand Down Expand Up @@ -59,7 +58,7 @@ describe('checkRequirement', () => {
})

test('there is a spinner message', async () => {
const result = await checkRequirement(badRule, context)
await checkRequirement(badRule, context)
expect(context.print.spin.mock.calls).toEqual([['Verifying YARN']])
})

Expand Down
1 change: 0 additions & 1 deletion __tests__/command_helpers/checkShell.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ShellRule, SolidarityRunContext } from '../../src/types'
import { strings } from 'gluegun/toolbox'
const checkShell: any = require('../../src/extensions/functions/checkShell')

Expand Down
11 changes: 5 additions & 6 deletions __tests__/command_helpers/getSolidaritySettings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { solidarity } from '../../src'
import getSolidaritySettings from '../../src/extensions/functions/getSolidaritySettings'

const context = require('mockContext')
Expand Down Expand Up @@ -26,15 +25,15 @@ describe('basic getSolidaritySettings', () => {
test('getSolidaritySettings can fail', () => {
expect(() => {
process.chdir('__tests__')
const resultSettings = getSolidaritySettings(context)
getSolidaritySettings(context)
}).toThrow()
process.chdir('../')
})

test('getSolidaritySettings can warn with missing requirements', () => {
expect(() => {
process.chdir('__tests__/sandbox/solidarity_broken')
const resultSettings = getSolidaritySettings(context)
getSolidaritySettings(context)
}).toThrowError('ERROR: Found, but no requirements key. Please validate your solidarity file')
process.chdir('../../../')
})
Expand Down Expand Up @@ -62,12 +61,12 @@ describe('parameterized getSolidaritySettings', () => {
// test longhand
context.parameters.options = { solidarityFile: '__tests__/fake' }
expect(() => {
const resultSettings = getSolidaritySettings(context)
getSolidaritySettings(context)
}).toThrowError('ERROR: There is no solidarity file at the given path')
// test shorthand
context.parameters.options = { f: '__tests__/fake' }
expect(() => {
const resultSettings = getSolidaritySettings(context)
getSolidaritySettings(context)
}).toThrowError('ERROR: There is no solidarity file at the given path')
context.parameters.options = {}
})
Expand Down Expand Up @@ -104,7 +103,7 @@ describe('parameterized getSolidaritySettings', () => {
test('errors if no solidarity file in module', () => {
context.parameters.options = { module: 'nope' }
expect(() => {
const resultSettings = getSolidaritySettings(context)
getSolidaritySettings(context)
}).toThrowError('ERROR: There is no solidarity file found with the given module')
context.parameters.options = {}
})
Expand Down
16 changes: 8 additions & 8 deletions __tests__/command_helpers/reviewRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('reviewRule', () => {
test('rule gets added', async () => {
const rule = ['NPM', [{ rule: 'cli', binary: 'npm' }]]

const result = await reviewRule(rule, reportResults, mockContext)
await reviewRule(rule, reportResults, mockContext)
// CLI rule was added
expect(reportResults.cliRules.length).toBe(2)
})
Expand All @@ -25,7 +25,7 @@ describe('reviewRule', () => {
test('rule gets added', async () => {
const rule = ['ANDROID', [{ rule: 'env', value: 'ANDROID_HOME' }]]

const result = await reviewRule(rule, reportResults, mockContext)
reviewRule(rule, reportResults, mockContext)
// CLI rule was added
expect(reportResults.envRules.length).toBe(2)
})
Expand All @@ -35,7 +35,7 @@ describe('reviewRule', () => {
test('rule gets added', async () => {
const rule = ['DIRECTORY', [{ rule: 'dir', binary: 'random' }]]

const result = await reviewRule(rule, reportResults, mockContext)
reviewRule(rule, reportResults, mockContext)
// CLI rule was added
expect(reportResults.filesystemRules.length).toBe(2)
})
Expand All @@ -45,7 +45,7 @@ describe('reviewRule', () => {
test('rule gets added', async () => {
const rule = ['FILE', [{ rule: 'file', binary: 'random' }]]

const result = await reviewRule(rule, reportResults, mockContext)
reviewRule(rule, reportResults, mockContext)
// CLI rule was added
expect(reportResults.filesystemRules.length).toBe(2)
})
Expand All @@ -55,9 +55,9 @@ describe('reviewRule', () => {
test('rule gets added', async () => {
const rule = ['SHELL', [{ rule: 'shell', command: 'ls', match: '.+' }]]

const result = await reviewRule(rule, reportResults, mockContext)
reviewRule(rule, reportResults, mockContext)
// SHELL rule was added
expect(reportResults.shellRules.length).toBe(2)
expect(reportResults.shellRules.length).toBe(1)
})
})

Expand All @@ -67,7 +67,7 @@ describe('reviewRule', () => {
const rule = ['CUSTOM', [{ rule: 'custom', plugin: 'Example Plugin', name: 'checkThing' }]]

expect(reportResults.cliRules.length).toBe(1)
const result = await reviewRule(rule, reportResults, mockContext)
await reviewRule(rule, reportResults, mockContext)
// CUSTOM rule (which adds CLI report) was added
expect(reportResults.cliRules.length).toBe(2)
})
Expand All @@ -76,7 +76,7 @@ describe('reviewRule', () => {
const rule = ['CUSTOM', [{ rule: 'custom', plugin: 'Example Plugin', name: 'checkSecondThing' }]]

expect(reportResults.cliRules.length).toBe(1)
const result = await reviewRule(rule, reportResults, mockContext)
await reviewRule(rule, reportResults, mockContext)
// should not change rules
expect(reportResults.cliRules.length).toBe(1)
})
Expand Down
1 change: 0 additions & 1 deletion __tests__/command_helpers/solidarityReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { SolidarityReportResults } from '../../src/types'
import { createReport } from '../../src/extensions/functions/solidarityReport'
const context = require('mockContext')

let reportResults: SolidarityReportResults
describe('solidarityReport structure', () => {
test('the basic function generates the Result object', () => {
let report = createReport(context)
Expand Down
1 change: 0 additions & 1 deletion __tests__/command_helpers/updateRequirement.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { platform } from 'os'
import { toPairs } from 'ramda'
const examplePlugin = require('examplePlugin')
const context = examplePlugin(require('mockContext'))
Expand Down
2 changes: 1 addition & 1 deletion __tests__/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ it('enforces required properties', () => {
})

test('check solidarity create with no parameter', async () => {
const result = await createCommand.run(mockContext)
await createCommand.run(mockContext)
expect(mockContext.print.error.mock.calls).toEqual([['Missing what to create'], ['solidarity create <wut?>']])
expect(mockContext.print.info.mock.calls.length).toBe(1)
})
Expand Down
2 changes: 1 addition & 1 deletion __tests__/commands/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ it('enforces required properties', () => {
})

test('check solidarity report', async () => {
const result = await reportCommand.run(mockContext)
await reportCommand.run(mockContext)
expect(mockContext.print.spin.mock.calls).toEqual([['Building Report']])
})
14 changes: 7 additions & 7 deletions __tests__/commands/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('without a .solidarity file', () => {

describe('with a .solidarity file', () => {
it('should attempt to update existing .snapshot file', async () => {
const restult = await snapshotCommand.run(context)
await snapshotCommand.run(context)
expect(context.solidarity.updateVersions.mock.calls.length).toEqual(1)
expect(context.solidarity.updateVersions.mock.calls).toEqual([[context]])
})
Expand Down Expand Up @@ -295,7 +295,7 @@ describe('with a .solidarity file', () => {
it('handles a binary enforceVersion: false', async () => {
expect(requirements()).toEqual({})

const result = await snapshotCommand.run(context)
await snapshotCommand.run(context)
expect(context.prompt.ask.mock.calls).toMatchSnapshot()
expect(requirements().Testorson).toBeTruthy()
expect(requirements().Testorson.semver).toBeFalsy()
Expand Down Expand Up @@ -323,7 +323,7 @@ describe('with a .solidarity file', () => {

expect(requirements()).toEqual({})

const result = await snapshotCommand.run(context)
await snapshotCommand.run(context)

expect(context.prompt.ask.mock.calls).toMatchSnapshot()
expect(requirements().Testorson).toBeTruthy()
Expand Down Expand Up @@ -360,7 +360,7 @@ describe('with a .solidarity file', () => {
}

expect(requirements()).toEqual({})
const result = await snapshotCommand.run(context)
await snapshotCommand.run(context)

expect(context.prompt.ask.mock.calls).toMatchSnapshot()
expect(requirements().Testorson).toBeTruthy()
Expand Down Expand Up @@ -397,7 +397,7 @@ describe('with a .solidarity file', () => {
}

expect(requirements()).toEqual({})
const result = await snapshotCommand.run(context)
await snapshotCommand.run(context)

expect(context.prompt.ask.mock.calls).toMatchSnapshot()
expect(requirements().Testorson).toBeTruthy()
Expand Down Expand Up @@ -434,7 +434,7 @@ describe('with a .solidarity file', () => {
}

expect(requirements()).toEqual({})
const result = await snapshotCommand.run(context)
await snapshotCommand.run(context)

expect(context.prompt.ask.mock.calls).toMatchSnapshot()
expect(requirements().Testorson).toBeTruthy()
Expand Down Expand Up @@ -479,7 +479,7 @@ describe('with a .solidarity file', () => {
it('should add the new shell rule', async () => {
expect(requirements()).toEqual({})

const result = await snapshotCommand.run(context)
await snapshotCommand.run(context)
expect(context.prompt.ask.mock.calls).toMatchSnapshot()
expect(requirements()['Git Email']).toBeTruthy()
expect(requirements()['Git Email'].length).toEqual(1)
Expand Down
4 changes: 2 additions & 2 deletions __tests__/commands/solidarity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ test('check base solidarity run', async () => {
})

test('check solidarity verbose run', async () => {
const result = await checkCommand.run(verboseMockContext)
await checkCommand.run(verboseMockContext)
expect(verboseMockContext.outputMode).toBe(SolidarityOutputMode.VERBOSE)
})

test('check solidarity config no output run', async () => {
const result = await checkCommand.run(noConfigMockContext)
await checkCommand.run(noConfigMockContext)
expect(noConfigMockContext.outputMode).toBe(SolidarityOutputMode.MODERATE)
})
4 changes: 2 additions & 2 deletions __tests__/docs/testDocs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import jetpack from 'fs-jetpack'
import path from 'path'
// import jetpack from 'fs-jetpack'
// import path from 'path'

// outgrown
// test('Verify each markdown file has a link in sidebar', () => {
Expand Down
1 change: 0 additions & 1 deletion __tests__/extensions/extensionCheck.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import path from 'path'
import solidarityExtension from '../../src/extensions/solidarity-extension'
const context = require('mockContext')

Expand Down
2 changes: 1 addition & 1 deletion __tests__/integration/solidarity-check/check-invalid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ afterAll(function() {

test('default looks for .solidarity file', async done => {
try {
await execa.shellSync(SOLIDARITY)
execa.shellSync(`${SOLIDARITY} --compiled`)
done.fail()
} catch (err) {
expect(err.code).not.toBe(0)
Expand Down
92 changes: 0 additions & 92 deletions __tests__/integration/solidarity-check/check-valid.ts

This file was deleted.

Loading