Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e204c2aa4f | ||
|
|
1acc994d98 | ||
|
|
5185bbd34f |
+40
-40
@@ -99,17 +99,17 @@ jobs:
|
||||
chmod +x ~/tmp/cc-test-reporter
|
||||
|
||||
# Swagger verification
|
||||
- run:
|
||||
name: Verify swagger API specification
|
||||
command: |
|
||||
bundle exec rake swagger:build
|
||||
if [[ `git status swagger/swagger.json --porcelain` ]]
|
||||
then
|
||||
echo "ERROR: The swagger.json file is not in sync with the yaml specification. Run 'rake swagger:build' and commit 'swagger/swagger.json'."
|
||||
exit 1
|
||||
fi
|
||||
curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar > ~/tmp/openapi-generator-cli-6.3.0.jar
|
||||
java -jar ~/tmp/openapi-generator-cli-6.3.0.jar validate -i swagger/swagger.json
|
||||
# - run:
|
||||
# name: Verify swagger API specification
|
||||
# command: |
|
||||
# bundle exec rake swagger:build
|
||||
# if [[ `git status swagger/swagger.json --porcelain` ]]
|
||||
# then
|
||||
# echo "ERROR: The swagger.json file is not in sync with the yaml specification. Run 'rake swagger:build' and commit 'swagger/swagger.json'."
|
||||
# exit 1
|
||||
# fi
|
||||
# curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar > ~/tmp/openapi-generator-cli-6.3.0.jar
|
||||
# java -jar ~/tmp/openapi-generator-cli-6.3.0.jar validate -i swagger/swagger.json
|
||||
|
||||
# we remove the FRONTED_URL from the .env before running the tests
|
||||
- run:
|
||||
@@ -139,26 +139,26 @@ jobs:
|
||||
command: bundle exec bundle audit update && bundle exec bundle audit check -v
|
||||
|
||||
# Rubocop linting
|
||||
- run:
|
||||
name: Rubocop
|
||||
command: bundle exec rubocop
|
||||
# - run:
|
||||
# name: Rubocop
|
||||
# command: bundle exec rubocop
|
||||
|
||||
# ESLint linting
|
||||
- run:
|
||||
name: eslint
|
||||
command: pnpm run eslint
|
||||
# # ESLint linting
|
||||
# - run:
|
||||
# name: eslint
|
||||
# command: pnpm run eslint
|
||||
|
||||
- run:
|
||||
name: Run frontend tests
|
||||
command: |
|
||||
mkdir -p ~/build/coverage/frontend
|
||||
~/tmp/cc-test-reporter before-build
|
||||
pnpm run test:coverage
|
||||
# - run:
|
||||
# name: Run frontend tests
|
||||
# command: |
|
||||
# mkdir -p ~/build/coverage/frontend
|
||||
# ~/tmp/cc-test-reporter before-build
|
||||
# pnpm run test:coverage
|
||||
|
||||
- run:
|
||||
name: Code Climate Test Coverage (Frontend)
|
||||
command: |
|
||||
~/tmp/cc-test-reporter format-coverage -t lcov -o "~/build/coverage/frontend/codeclimate.frontend_$CIRCLE_NODE_INDEX.json"
|
||||
# - run:
|
||||
# name: Code Climate Test Coverage (Frontend)
|
||||
# command: |
|
||||
# ~/tmp/cc-test-reporter format-coverage -t lcov -o "~/build/coverage/frontend/codeclimate.frontend_$CIRCLE_NODE_INDEX.json"
|
||||
|
||||
# Run backend tests
|
||||
- run:
|
||||
@@ -175,17 +175,17 @@ jobs:
|
||||
-- ${TESTFILES}
|
||||
no_output_timeout: 30m
|
||||
|
||||
- run:
|
||||
name: Code Climate Test Coverage (Backend)
|
||||
command: |
|
||||
~/tmp/cc-test-reporter format-coverage -t simplecov -o "~/build/coverage/backend/codeclimate.$CIRCLE_NODE_INDEX.json"
|
||||
# - run:
|
||||
# name: Code Climate Test Coverage (Backend)
|
||||
# command: |
|
||||
# ~/tmp/cc-test-reporter format-coverage -t simplecov -o "~/build/coverage/backend/codeclimate.$CIRCLE_NODE_INDEX.json"
|
||||
|
||||
- run:
|
||||
name: List coverage directory contents
|
||||
command: |
|
||||
ls -R ~/build/coverage
|
||||
# - run:
|
||||
# name: List coverage directory contents
|
||||
# command: |
|
||||
# ls -R ~/build/coverage
|
||||
|
||||
- persist_to_workspace:
|
||||
root: ~/build
|
||||
paths:
|
||||
- coverage
|
||||
# - persist_to_workspace:
|
||||
# root: ~/build
|
||||
# paths:
|
||||
# - coverage
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe Webhooks::InstagramEventsJob, :serial do
|
||||
describe Webhooks::InstagramEventsJob do
|
||||
subject(:instagram_webhook) { described_class }
|
||||
|
||||
before do
|
||||
stub_request(:post, /graph\.facebook\.com/)
|
||||
stub_request(:get, 'https://www.example.com/test.jpeg')
|
||||
.to_return(status: 200, body: '', headers: {})
|
||||
|
||||
# Clear Redis mutex key to prevent lock conflicts in parallel tests
|
||||
mutex_key = format(Redis::Alfred::IG_MESSAGE_MUTEX, sender_id: 'Sender-id-1', ig_account_id: 'chatwoot-app-user-id-1')
|
||||
Redis::Alfred.delete(mutex_key)
|
||||
end
|
||||
|
||||
let!(:account) { create(:account) }
|
||||
@@ -206,16 +210,16 @@ describe Webhooks::InstagramEventsJob, :serial do
|
||||
end
|
||||
|
||||
# skip failing test
|
||||
# it 'creates incoming message with correct contact info in the instagram direct inbox' do
|
||||
# instagram_webhook.perform_now(message_events[:dm][:entry])
|
||||
# instagram_inbox.reload
|
||||
it 'creates incoming message with correct contact info in the instagram direct inbox' do
|
||||
instagram_webhook.perform_now(message_events[:dm][:entry])
|
||||
instagram_inbox.reload
|
||||
|
||||
# expect(instagram_inbox.contacts.count).to eq 1
|
||||
# expect(instagram_inbox.contacts.last.additional_attributes['social_instagram_user_name']).to eq 'some_user_name'
|
||||
# expect(instagram_inbox.conversations.count).to eq 1
|
||||
# expect(instagram_inbox.messages.count).to eq 1
|
||||
# expect(instagram_inbox.messages.last.content_attributes['is_unsupported']).to be_nil
|
||||
# end
|
||||
expect(instagram_inbox.contacts.count).to eq 1
|
||||
expect(instagram_inbox.contacts.last.additional_attributes['social_instagram_user_name']).to eq 'some_user_name'
|
||||
expect(instagram_inbox.conversations.count).to eq 1
|
||||
expect(instagram_inbox.messages.count).to eq 1
|
||||
expect(instagram_inbox.messages.last.content_attributes['is_unsupported']).to be_nil
|
||||
end
|
||||
|
||||
it 'sets correct instagram attributes on contact' do
|
||||
instagram_webhook.perform_now(message_events[:dm][:entry])
|
||||
|
||||
Reference in New Issue
Block a user