-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from Ximaz/unit-tests
Adding unit tests, adding the pinned server feature.
- Loading branch information
Showing
68 changed files
with
4,873 additions
and
2,416 deletions.
There are no files selected for viewing
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,2 +1,3 @@ | ||
node_modules | ||
dist | ||
dist | ||
tests |
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 @@ | ||
github: PABLO-1610 |
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,7 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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,23 @@ | ||
name: ESLint | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
name: ESLint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
cache: npm | ||
|
||
- name: Install ESLint | ||
run: npm install | ||
|
||
- name: Run ESLint | ||
run: npm run lint |
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,44 @@ | ||
name: Node.js Package | ||
|
||
on: | ||
release: | ||
types: [ created ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
- run: npm ci | ||
- run: npm test | ||
|
||
publish-npm: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
|
||
publish-gpr: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
registry-url: https://npm.pkg.github.com/ | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.GIT_TOKEN}} |
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,35 @@ | ||
name: unit-tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
check_lib_compilation: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install Dependencies | ||
run: npm i --save | ||
|
||
- name: Compile Library | ||
run: npm run compile | ||
|
||
run_tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install Dependencies | ||
run: npm i -D | ||
|
||
- name: Execute Unit Tests | ||
run: npm run test |
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,4 +1,5 @@ | ||
export * from "./types"; | ||
export declare function fetchServer(id: string): Promise<import("./models/CfxCitizenServer").default | undefined>; | ||
export declare function fetchStatus(): Promise<import("./models/CfxStatus").default | undefined>; | ||
export declare function fetchUnresolvedIncidents(): Promise<import("./types").CfxUnresolvedIncidents | undefined>; | ||
export * from "./types"; | ||
export declare function fetchServer(id: string): Promise<import("./models/CfxCitizenServer").default | undefined>; | ||
export declare function fetchStatus(): Promise<import("./models/CfxStatus").default | undefined>; | ||
export declare function fetchUnresolvedIncidents(): Promise<import("./models/CfxUnresolvedIncidents").default | undefined>; | ||
export declare function fetchPinnedServers(): Promise<import("./models/CfxPinnedServers").default | undefined>; |
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,36 +1,41 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fetchUnresolvedIncidents = exports.fetchStatus = exports.fetchServer = void 0; | ||
const CfxStatus_module_1 = __importDefault(require("./modules/CfxStatus.module")); | ||
const CfxCitizenServer_module_1 = __importDefault(require("./modules/CfxCitizenServer.module")); | ||
const CfxUnresolvedIncidents_module_1 = __importDefault(require("./modules/CfxUnresolvedIncidents.module")); | ||
__exportStar(require("./types"), exports); | ||
async function fetchServer(id) { | ||
return await CfxCitizenServer_module_1.default.get().retrieve(id); | ||
} | ||
exports.fetchServer = fetchServer; | ||
async function fetchStatus() { | ||
return await CfxStatus_module_1.default.get().retrieve(); | ||
} | ||
exports.fetchStatus = fetchStatus; | ||
async function fetchUnresolvedIncidents() { | ||
return await CfxUnresolvedIncidents_module_1.default.get().retrieve(); | ||
} | ||
exports.fetchUnresolvedIncidents = fetchUnresolvedIncidents; | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fetchPinnedServers = exports.fetchUnresolvedIncidents = exports.fetchStatus = exports.fetchServer = void 0; | ||
const CfxStatus_module_1 = __importDefault(require("./modules/CfxStatus.module")); | ||
const CfxCitizenServer_module_1 = __importDefault(require("./modules/CfxCitizenServer.module")); | ||
const CfxUnresolvedIncidents_module_1 = __importDefault(require("./modules/CfxUnresolvedIncidents.module")); | ||
const CfxPinnedServers_module_1 = __importDefault(require("./modules/CfxPinnedServers.module")); | ||
__exportStar(require("./types"), exports); | ||
async function fetchServer(id) { | ||
return await CfxCitizenServer_module_1.default.get().retrieve(id); | ||
} | ||
exports.fetchServer = fetchServer; | ||
async function fetchStatus() { | ||
return await CfxStatus_module_1.default.get().retrieve(); | ||
} | ||
exports.fetchStatus = fetchStatus; | ||
async function fetchUnresolvedIncidents() { | ||
return await CfxUnresolvedIncidents_module_1.default.get().retrieve(); | ||
} | ||
exports.fetchUnresolvedIncidents = fetchUnresolvedIncidents; | ||
async function fetchPinnedServers() { | ||
return await CfxPinnedServers_module_1.default.get().retrieve(); | ||
} | ||
exports.fetchPinnedServers = fetchPinnedServers; |
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,9 +1,9 @@ | ||
import { CfxCitizenPlayerPayload } from "../types"; | ||
export default class CfxCitizenPlayer { | ||
endpoint: string; | ||
id: number; | ||
identifiers: string[]; | ||
name: string; | ||
ping: number; | ||
constructor(payload: CfxCitizenPlayerPayload); | ||
} | ||
import { CfxCitizenPlayerPayload } from "../types"; | ||
export default class CfxCitizenPlayer { | ||
endpoint: string; | ||
id: number; | ||
identifiers: string[]; | ||
name: string; | ||
ping: number; | ||
constructor(payload: CfxCitizenPlayerPayload); | ||
} |
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,17 +1,17 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class CfxCitizenPlayer { | ||
endpoint; | ||
id; | ||
identifiers; | ||
name; | ||
ping; | ||
constructor(payload) { | ||
this.endpoint = payload.endpoint; | ||
this.id = payload.id; | ||
this.identifiers = payload.identifiers; | ||
this.name = payload.name; | ||
this.ping = payload.ping; | ||
} | ||
} | ||
exports.default = CfxCitizenPlayer; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class CfxCitizenPlayer { | ||
endpoint; | ||
id; | ||
identifiers; | ||
name; | ||
ping; | ||
constructor(payload) { | ||
this.endpoint = payload.endpoint; | ||
this.id = payload.id; | ||
this.identifiers = payload.identifiers; | ||
this.name = payload.name; | ||
this.ping = payload.ping; | ||
} | ||
} | ||
exports.default = CfxCitizenPlayer; |
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,39 +1,39 @@ | ||
import { CfxCitizenServerData, CfxCitizenServerDataData } from "../types"; | ||
export default class CitizenServer { | ||
id: string; | ||
data: CfxCitizenServerDataData; | ||
constructor(data: CfxCitizenServerData); | ||
get playersCount(): number; | ||
get players(): import("../types").CfxCitizenPlayerPayload[]; | ||
get gameType(): string; | ||
get hostname(): string; | ||
get mapName(): string; | ||
get maxPlayers(): number; | ||
get enhancedHostSupport(): boolean; | ||
get resources(): string[]; | ||
get serverVersion(): string; | ||
get publicVariables(): import("../types").CfxCitizenServerDataPublicVariables; | ||
get playersCountFromServerReport(): number; | ||
get ownerId(): number; | ||
get private(): boolean; | ||
get fallback(): boolean; | ||
get connectedEndpoints(): string[]; | ||
get upvotePower(): number; | ||
get burstPower(): number; | ||
get supported(): string; | ||
get ownerName(): string; | ||
get ownerProfileUrl(): string; | ||
get ownerAvatarUrl(): string; | ||
get lastSeenDate(): string; | ||
get iconVersion(): number; | ||
get isOneSyncEnabled(): boolean; | ||
get elementClub(): string; | ||
get tags(): string[]; | ||
get projectName(): string; | ||
get projectDesc(): string; | ||
get isFull(): boolean; | ||
hasResource(resource: string): boolean; | ||
hasAnyResourceStartingWith(resource: string): boolean; | ||
hasTag(tag: string): boolean; | ||
isPlayerOnline(name: string): boolean; | ||
} | ||
import { CfxCitizenServerData, CfxCitizenServerDataData } from "../types"; | ||
export default class CitizenServer { | ||
id: string; | ||
data: CfxCitizenServerDataData; | ||
constructor(data: CfxCitizenServerData); | ||
get playersCount(): number; | ||
get players(): import("../types").CfxCitizenPlayerPayload[]; | ||
get gameType(): string; | ||
get hostname(): string; | ||
get mapName(): string; | ||
get maxPlayers(): number; | ||
get enhancedHostSupport(): boolean; | ||
get resources(): string[]; | ||
get serverVersion(): string; | ||
get publicVariables(): import("../types").CfxCitizenServerDataPublicVariables; | ||
get playersCountFromServerReport(): number; | ||
get ownerId(): number; | ||
get private(): boolean; | ||
get fallback(): boolean; | ||
get connectedEndpoints(): string[]; | ||
get upvotePower(): number; | ||
get burstPower(): number; | ||
get supported(): string; | ||
get ownerName(): string; | ||
get ownerProfileUrl(): string; | ||
get ownerAvatarUrl(): string; | ||
get lastSeenDate(): string; | ||
get iconVersion(): number; | ||
get isOneSyncEnabled(): boolean; | ||
get elementClub(): string; | ||
get tags(): string[]; | ||
get projectName(): string; | ||
get projectDesc(): string; | ||
get isFull(): boolean; | ||
hasResource(resource: string): boolean; | ||
hasAnyResourceStartingWith(resource: string): boolean; | ||
hasTag(tag: string): boolean; | ||
isPlayerOnline(name: string): boolean; | ||
} |
Oops, something went wrong.