Skip to content

Commit

Permalink
add pack-n-play tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelgrosso1 committed Sep 29, 2023
1 parent 869ee76 commit e73b5dc
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"mockery": "^2.1.0",
"nock": "~13.3.0",
"node-fetch": "^2.6.7",
"pack-n-play": "^2.0.0",
"proxyquire": "^2.1.3",
"sinon": "^16.0.0",
"tmp": "^0.2.0",
Expand Down
22 changes: 22 additions & 0 deletions system-test/fixtures/index-cjs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */
const {Storage} = require('@google-cloud/storage');

function main() {
const storage = new Storage();
}

main();
22 changes: 22 additions & 0 deletions system-test/fixtures/index-esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* eslint-disable node/no-missing-import, no-unused-vars */
import {Storage} from '@google-cloud/storage';

function main() {
const storage = new Storage();
}

main();
37 changes: 37 additions & 0 deletions system-test/install.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import {packNTest} from 'pack-n-play';
import {readFileSync} from 'fs';
import {describe, it} from 'mocha';

describe('pack-n-play tests', () => {
it('ESM module', async () => {
await packNTest({
sample: {
description: 'Should be able to import the storage library in ESM',
esm: readFileSync('./system-test/fixtures/index-esm.js').toString(),
},
});
});

it('CJS module', async () => {
await packNTest({
sample: {
description: 'Should be able to import the storage library in CJS',
cjs: readFileSync('./system-test/fixtures/index-cjs.js').toString(),
},
});
});
});

0 comments on commit e73b5dc

Please sign in to comment.