Skip to content
Open
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
28 changes: 14 additions & 14 deletions .github/workflows/restrict-prs.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Restrict PRs to Main
# name: Restrict PRs to Main

on:
pull_request:
branches:
- main
# on:
# pull_request:
# branches:
# - main

jobs:
restrict-pr:
runs-on: ubuntu-latest
steps:
- name: Check if PR is from development branch
if: github.event.pull_request.head.ref != 'development'
run: |
echo "Only pull requests from the 'development' branch are allowed."
exit 1
# jobs:
# restrict-pr:
# runs-on: ubuntu-latest
# steps:
# - name: Check if PR is from development branch
# if: github.event.pull_request.head.ref != 'development'
# run: |
# echo "Only pull requests from the 'development' branch are allowed."
# exit 1
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"homepage": "https://github.com/DanielRomeo/jackscript-js#readme",
"dependencies": {
"@nestjs/throttler": "^6.2.1",
"@types/jest": "^29.5.12",
"jest": "^29.7.0",
"ts-jest": "^29.2.4"
Expand Down
4 changes: 1 addition & 3 deletions src/romeo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ let codfalse = [1,1];
// console.log(isCoordinate<string, number>(cod3)) // returns
//console.log(isCoordinate(codfalse)) // returns false


// console.log(coordinatesEqual(cod, reflexiveTest[0]));
// console.log(reflexiveTest.entries().next());
// console.log(reflexiveTest.values().next());

// const func = () => {
// reflexiveTest.forEach(element => {
Expand Down
25 changes: 24 additions & 1 deletion src/typechecker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@ describe('Coordinates typechecker methods.', () => {
let coordinate2 : Coordinate<number, number>;
let coordinate3 : Coordinate<string, number>;
let coordinate4 : Coordinate<string, string>;

let coordinate5 : Coordinate<number, number>;
let coordinate5fake = [1,1,2];
let cod : Coordinate<number, number>;
let testJackscriptSet = new JackscriptSet<Coordinate<number, number>>([[1,1],[2,2],[3,3]]);

beforeEach(() => {
coordinate1 = [1,1];
coordinate2 = [2,2];
coordinate3 = ["a",1];
coordinate4 = ["a", "b"];
cod = [1,1];
coordinate5 = [3,3];
});

// test if variables are valide coordinates or not:
Expand All @@ -33,8 +39,25 @@ describe('Coordinates typechecker methods.', () => {
it('Value is NOT a coordinate.', () => {
expect(isCoordinate(coordinate5fake)).toBe(false);
})


// test the coordinatesEqual() function:
it('Two coordinates are equal.', () => {
expect(coordinatesEqual(coordinate1, [1,1])).toBe(true);
})
it('Two coordinates are equal.', () => {
expect(coordinatesEqual(coordinate1, testJackscriptSet.values().next().value)).toBe(true);
})
// loop through identical arrays that are created differently and compare elems in each array
it('Two coordinates are equal.', () => {
let JacksriptElement = testJackscriptSet.values();
[coordinate1,coordinate2, coordinate5].forEach(element => {
expect(coordinatesEqual(element, JacksriptElement.next().value)).toBe(true);
});

})
});





5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"

"@nestjs/throttler@^6.2.1":
version "6.2.1"
resolved "https://registry.yarnpkg.com/@nestjs/throttler/-/throttler-6.2.1.tgz#c241788a8b195e6c7c0cf94b1808c4cb940ac2fd"
integrity sha512-vdt6VjhKC6vcLBJRUb97IuR6Htykn5kokZzmT8+S5XFOLLjUF7rzRpr+nUOhK9pi1L0hhbzSf2v2FJl4v64EJA==

"@sinclair/typebox@^0.27.8":
version "0.27.8"
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e"
Expand Down