Skip to content

Commit

Permalink
chore: mark skipped tests (#154)
Browse files Browse the repository at this point in the history
* chore: mark skipped tests

* chore: re-enable .env var

* chore: test injecting test env

* chore: test

* chore: test

* chore: test

* chore: revert back to basic test workflow

* chore: increase test timeout

* chore: add env var for aws
  • Loading branch information
wa0x6e authored Aug 14, 2023
1 parent 8d2e215 commit fe86a9d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 35 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ jobs:
test:
runs-on: ubuntu-20.04
env:
# FLEEK_API_KEY: ${{ secrets.FLEEK_API_KEY }}
# FLEEK_API_SECRET: ${{ secrets.FLEEK_API_SECRET }}
FLEEK_API_KEY: ${{ secrets.FLEEK_API_KEY }}
FLEEK_API_SECRET: ${{ secrets.FLEEK_API_SECRET }}
INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }}
INFURA_PROJECT_SECRET: ${{ secrets.INFURA_PROJECT_SECRET }}
# PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
# PINATA_API_SECRET: ${{ secrets.PINATA_API_SECRET }}
# WEB3STORAGE_API_TOKEN: ${{ secrets.WEB3STORAGE_API_TOKEN }}
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
PINATA_API_SECRET: ${{ secrets.PINATA_API_SECRET }}
WEB3STORAGE_API_TOKEN: ${{ secrets.WEB3STORAGE_API_TOKEN }}
EVER_API_KEY: ${{ secrets.EVER_API_KEY }}
EVER_API_SECRET: ${{ secrets.EVER_API_SECRET }}
EVER_BUCKET_NAME: ${{ secrets.EVER_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down
59 changes: 29 additions & 30 deletions test/unit/providers/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,36 @@ describe('providers', () => {
};

function buildProviderPayload(providers, version) {
return providers
.map(
p =>
p.isConfigured() && {
name: p.provider,
set: p.set,
idVersion: version
}
)
.filter(a => a);
return providers.map(p => ({
name: p.provider,
provider: p,
idVersion: version
}));
}

const providerPayload: { name: string; set: any; idVersion: string }[] = buildProviderPayload(
[Fleek, Infura, Pinata],
'v0'
).concat(buildProviderPayload([Web3Storage, FourEverland], 'v1'));

describe.each(providerPayload)('$name', ({ name, set, idVersion }) => {
it('should upload a JSON file', async () => {
const result = await set(json.input);

expect(result.provider).toBe(name);
expect(result.cid).toBe(json.output[idVersion]);
}, 10e3);

it('should upload an image file', async () => {
const buffer = await image.input;
const result = await set(buffer);

expect(result.provider).toBe(name);
expect(result.cid).toBe(image.output[idVersion]);
}, 10e3);
const providerPayload: { name: string; provider: any; idVersion: string }[] =
buildProviderPayload([Fleek, Infura, Pinata], 'v0').concat(
buildProviderPayload([Web3Storage, FourEverland], 'v1')
);

describe.each(providerPayload)('$name', ({ name, provider, idVersion }) => {
if (!provider.isConfigured()) {
it.todo(`needs to set credentials for ${name}`);
} else {
it('should upload a JSON file', async () => {
const result = await provider.set(json.input);

expect(result.provider).toBe(name);
expect(result.cid).toBe(json.output[idVersion]);
}, 20e3);

it('should upload an image file', async () => {
const buffer = await image.input;
const result = await provider.set(buffer);

expect(result.provider).toBe(name);
expect(result.cid).toBe(image.output[idVersion]);
}, 20e3);
}
});
});

0 comments on commit fe86a9d

Please sign in to comment.