Skip to content

Commit

Permalink
configuration to use require for module import
Browse files Browse the repository at this point in the history
  • Loading branch information
andremarquezz committed Jul 13, 2024
1 parent e62f708 commit a0e91b5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ npm install --save-dev fakerbankbr
## 🪄Uso

```javascript
import { createFakeBankAccount } from 'fakerbankbr';
const { createFakeBankAccount } = require('fakerbankbr');

// Gerar uma única conta bancária
let conta;
Expand Down
4 changes: 2 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from "cypress";
const { defineConfig } = require('cypress');

export default defineConfig({
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
Expand Down
4 changes: 1 addition & 3 deletions cypress/e2e/fakeBankAccount.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// cypress/integration/fakeBankAccount.spec.js

import { createFakeBankAccount } from '../../index.mjs';
const { createFakeBankAccount } = require('../../index');

describe('createFakeBankAccount', () => {
it('should create a single fake bank account', () => {
Expand Down
4 changes: 3 additions & 1 deletion httpcodes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
const httpcodes = {
0: {
code: 'Not Error',
why: 'Default message to default response from code.',
Expand Down Expand Up @@ -260,3 +260,5 @@ export default {
why: 'This code means that the user needs to authenticate himself to have access to some network.',
},
};

module.exports = httpcodes;
14 changes: 9 additions & 5 deletions index.mjs → index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';
import cheerio from 'cheerio';
import https from 'https';
import querystring from 'querystring';
import httpcodes from './httpcodes.js';
const cheerio = require('cheerio');
const httpcodes = require('./httpcodes'); // Assumindo que httpcodes.js está no mesmo diretório
const https = require('https');
const querystring = require('querystring');

export const createFakeBankAccount = (quantity = 1) => {
const createFakeBankAccount = (quantity = 1) => {
return new Promise((resolve, reject) => {
if (quantity > 10) {
quantity = 10;
Expand Down Expand Up @@ -135,3 +135,7 @@ function parseResponse(res, data) {

return response;
}

module.exports = {
createFakeBankAccount: createFakeBankAccount,
};
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "fakerbankbr",
"version": "1.1.0",
"version": "1.1.1",
"description": "O fakerBankBR é um wrapper em Node.js para o serviço 4devs que permite gerar dados bancários falsos brasileiros. Este pacote é uma simples de obter informações de contas bancárias fictícias, incluindo número da conta, dígito verificador, agência e banco. É útil para testes de software, desenvolvimento e qualquer outro cenário em que dados bancários válidos sejam necessários sem comprometer a segurança.",
"main": "index.js",
"type": "module",
"scripts": {
"test": "npx cypress open",
"test:headless": "npx cypress run"
Expand Down

0 comments on commit a0e91b5

Please sign in to comment.