Skip to content

Commit

Permalink
build: fix tests for newer versions of protobufjs-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
kmontag committed May 18, 2023
1 parent 0026424 commit f3172a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/basic.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ syntax = "proto3";
package foo;
message Bar {
string baz = 1;
}
}
13 changes: 11 additions & 2 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,19 @@ describe('protobufjs-loader', function () {
throw readErr;
}
const declarations = content.toString();
assert.equal(
declarations.trim(),
// Make sure the main protobufjs import shows up.
assert.include(
declarations,
'import * as $protobuf from "protobufjs";'
);
// Some versions of protobufjs-cli will also include
// additional imports. Make sure all non-empty lines are
// imports.
for (const line of declarations.split('\n')) {
if (line.trim().length !== 0) {
assert.include(line, 'import');
}
}
done();
});
});
Expand Down

0 comments on commit f3172a7

Please sign in to comment.