Fix license test

This commit is contained in:
trickypr 2022-03-27 17:26:23 +11:00
parent d84204ef17
commit ffef881079
2 changed files with 13 additions and 2 deletions

View file

@ -1,11 +1,22 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
import { join } from 'path'
import { isValidLicense } from './license-check'
describe('isValidLicense', () => {
it('Returns true if the file contains a valid license', async () => {
expect(await isValidLicense('./license-check.test.ts')).toBe(true)
expect(await isValidLicense(join(__dirname, 'license-check.test.ts'))).toBe(
true
)
})
it('Returns false if the file contains an invalid license header', async () => {
expect(await isValidLicense('./tests/invalid-license.txt')).toBe(false)
expect(
await isValidLicense(
join(__dirname, '../../tests/assets/invalid-license.txt')
)
).toBe(false)
})
})