mirror of
https://github.com/sbrow/strings.git
synced 2025-12-29 15:17:38 -05:00
fix: Fixed nix build.
This commit is contained in:
40
flake.lock
generated
40
flake.lock
generated
@@ -1,20 +1,44 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"bp": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1680665430,
|
"lastModified": 1685037876,
|
||||||
"narHash": "sha256-MTVhTukwza1Jlq2gECITZPFnhROmylP2uv3O3cSqQCE=",
|
"narHash": "sha256-ccqZqY6wUFot0ewyNKQUrMR6IEliGza+pjKoSVMXIeM=",
|
||||||
"path": "/nix/store/0acd255ca1v8m4xcg5wjhi9pgmx7q2s5-source",
|
"owner": "sbrow",
|
||||||
"rev": "5233fd2ba76a3accb5aaa999c00509a11fd0793c",
|
"repo": "nix-npm-buildpackage",
|
||||||
"type": "path"
|
"rev": "8a834ccbadee80c0ee313494f1ee95b0775b3f16",
|
||||||
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"owner": "sbrow",
|
||||||
"type": "indirect"
|
"repo": "nix-npm-buildpackage",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1684936879,
|
||||||
|
"narHash": "sha256-BOSq/QiX7MDs8tUnAt4+nYTJctgYkzVSNL95qlfMYeM=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "99fe1b870522d6ee3e692c2b6e663d6868a3fde4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-22.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"bp": "bp",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
27
flake.nix
27
flake.nix
@@ -1,7 +1,14 @@
|
|||||||
{
|
{
|
||||||
description = "Simple, functional, dependency free string manipulation in Vanilla JS";
|
description = "Simple, functional, dependency free string manipulation in Vanilla JS";
|
||||||
|
|
||||||
outputs = { self, nixpkgs }:
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
|
||||||
|
# bp.url = "github:serokell/nix-npm-buildpackage";
|
||||||
|
bp.url = "github:sbrow/nix-npm-buildpackage";
|
||||||
|
bp.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { bp, self, nixpkgs }:
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
in {
|
in {
|
||||||
@@ -11,23 +18,9 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
checks.x86_64-linux.default = pkgs.stdenv.mkDerivation {
|
checks.x86_64-linux.default = bp.outputs.legacyPackages.x86_64-linux.buildYarnPackage {
|
||||||
name = "strings-check";
|
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
yarnBuildMore = "yarn test";
|
||||||
nativeBuildInputs = with pkgs; [ yarn ];
|
|
||||||
buildPhase = ''
|
|
||||||
# this line removes a bug where value of $HOME is set to a non-writable /homeless-shelter dir
|
|
||||||
export HOME=$(pwd)
|
|
||||||
|
|
||||||
yarn
|
|
||||||
yarn test
|
|
||||||
'';
|
|
||||||
checkPhase = ''
|
|
||||||
yarn test
|
|
||||||
'';
|
|
||||||
installPhase = ''
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,21 @@ import {
|
|||||||
} from './index';
|
} from './index';
|
||||||
|
|
||||||
describe('strings', () => {
|
describe('strings', () => {
|
||||||
|
describe('startsWith', () => {
|
||||||
|
it('returns true if haystack starts with needle', () => {
|
||||||
|
expect(startsWith('foo', 'foobar')).toBe(true);
|
||||||
|
})
|
||||||
|
it('returns true when haystack is needle', () => {
|
||||||
|
expect(startsWith('foo', 'foo')).toBe(true);
|
||||||
|
})
|
||||||
|
it('works', () => {
|
||||||
|
fc.assert(fc.property(fc.string(), fc.string(), (needle, haystack) => {
|
||||||
|
if (haystack.indexOf(needle) == 0) {
|
||||||
|
expect(startsWith(needle, haystack)).toBe(true);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
})
|
||||||
|
});
|
||||||
// describe('afterFirstWord', () => {
|
// describe('afterFirstWord', () => {
|
||||||
// it('removes the first word', () => {
|
// it('removes the first word', () => {
|
||||||
// fc.assert(fc.property(fc.string(), (str) => {
|
// fc.assert(fc.property(fc.string(), (str) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user