-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mateusz Duda
committed
May 28, 2024
1 parent
a684df9
commit 33b604b
Showing
7 changed files
with
235 additions
and
1,475 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
const nodeFetch = require("node-fetch"); | ||
const betterAjvErrors = require('better-ajv-errors'); | ||
import Ajv from 'ajv'; | ||
import { Logger } from '../Logger/Logger'; | ||
const betterAjvErrors = require("better-ajv-errors"); | ||
import Ajv from "ajv"; | ||
import { Logger } from "../Logger/Logger"; | ||
|
||
export class ADFValidator { | ||
private static SCHEMA_URL = "https://unpkg.com/@atlaskit/[email protected]/dist/json-schema/v1/full.json"; | ||
|
||
private _schema: Object; | ||
private _schema: unknown; | ||
|
||
public constructor() { } | ||
|
||
public async loadSchema(): Promise<any> { | ||
public async loadSchema(): Promise<void> { | ||
console.log("[ADFValidator] Fetching latest JSON schema"); | ||
|
||
const response = await nodeFetch(ADFValidator.SCHEMA_URL); | ||
|
@@ -29,7 +29,7 @@ export class ADFValidator { | |
console.log("[ADFValidator] Validating ADF..."); | ||
|
||
if (!this._schema) { | ||
throw new Error(`[ADFValidator] Schema is not loaded yet, call await loadSchema() before validation`); | ||
throw new Error("[ADFValidator] Schema is not loaded yet, call await loadSchema() before validation"); | ||
} | ||
|
||
const ajv = new Ajv({ jsonPointers: true }); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { getFirstLine } from "../utils/utils"; | ||
|
||
describe("Quality checks", () => { | ||
it("Check if the first line of scope.ts is correct (sometimes there is 'nodeimport' there)", async () => { | ||
const EXPECTED_FIRST_LINE = "#!/usr/bin/env node"; | ||
|
||
const firstLine = await getFirstLine("./src/scope.ts"); | ||
expect(firstLine).toBe(EXPECTED_FIRST_LINE); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters