Skip to content

Commit

Permalink
chore: update test command to run missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
notaphplover committed Nov 7, 2024
1 parent 6bac162 commit a5d7136
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"postupdate": "git diff-files --quiet package-lock.json || npm test",
"prepublish": "npm run build && publish-please guard",
"publish-please": "publish-please",
"test": "nyc --reporter=lcov --require ts-node/register mocha test/**/*.test.ts --reporter spec --retries 3 --require 'node_modules/reflect-metadata/Reflect.js' --exit",
"test": "nyc --reporter=lcov --require ts-node/register mocha ./test/*.test.ts test/**/*.test.ts --reporter spec --retries 3 --require 'node_modules/reflect-metadata/Reflect.js' --exit",
"update": "updates --update --minor && npm install"
},
"sideEffects": false,
Expand Down
11 changes: 5 additions & 6 deletions test/inversify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2012,7 +2012,8 @@ describe('InversifyJS', () => {
const errorFunction: () => void = () => {
container.get<Warrior>(SYMBOLS.SamuraiMaster);
};
const error: string = ERROR_MSGS.ARGUMENTS_LENGTH_MISMATCH('SamuraiMaster');
const error: string =
'No matching bindings found for serviceIdentifier: Object';
expect(errorFunction).to.throw(error);

const samuraiMaster2: SamuraiMaster2 = container.get<SamuraiMaster2>(
Expand Down Expand Up @@ -2934,7 +2935,7 @@ describe('InversifyJS', () => {
expect(samurai.rank).eql('Master');
});

it('Should be able to identify missing @injectable in a base class', () => {
it('Should not throw due to a missing @injectable in a base class', () => {
// eslint-disable-next-line @typescript-eslint/typedef
const SYMBOLS = {
SamuraiMaster: Symbol.for('SamuraiMaster'),
Expand Down Expand Up @@ -2963,12 +2964,10 @@ describe('InversifyJS', () => {
const container: Container = new Container();
container.bind<Warrior>(SYMBOLS.SamuraiMaster).to(SamuraiMaster);

function throws() {
function notThrows() {
return container.get<Warrior>(SYMBOLS.SamuraiMaster);
}

expect(throws).to.throw(
`${ERROR_MSGS.MISSING_INJECTABLE_ANNOTATION} Samurai`,
);
expect(notThrows).not.to.throw();
});
});

0 comments on commit a5d7136

Please sign in to comment.